mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-13 21:36:00 +03:00
Best practices: Checking if variables are null before use it
This commit is contained in:
parent
bc390c6659
commit
207c85d9f7
@ -217,6 +217,10 @@ ngx_pstrdup0(ngx_pool_t *pool, ngx_str_t *src)
|
||||
{
|
||||
u_char *dst;
|
||||
|
||||
if (src == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dst = ngx_pnalloc(pool, src->len + 1);
|
||||
if (dst == NULL) {
|
||||
return NULL;
|
||||
@ -522,6 +526,10 @@ static int ngx_http_modsecurity_save_headers_in_visitor(void *data,
|
||||
ngx_http_header_t *hh;
|
||||
ngx_http_core_main_conf_t *cmcf;
|
||||
|
||||
if (r == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
h = ngx_list_push(&r->headers_in.headers);
|
||||
if (h == NULL) {
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user