Best practices: Checking if variables are null before use it

This commit is contained in:
Eldar Zaitov 2014-06-13 23:42:09 +04:00 committed by Felipe Zimmerle
parent bc390c6659
commit 207c85d9f7

View File

@ -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;