comparison src/http/modules/ngx_http_log_module.c @ 2912:c7d57b539248

return NULL instead of NGX_CONF_ERROR on a create conf failure
author Igor Sysoev <igor@sysoev.ru>
date Tue, 02 Jun 2009 16:09:44 +0000
parents 09cab3f8d92e
children cd8738e76610 415400fa0f10
comparison
equal deleted inserted replaced
2911:32b444fa2ca4 2912:c7d57b539248
712 712
713 ngx_http_log_fmt_t *fmt; 713 ngx_http_log_fmt_t *fmt;
714 714
715 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_log_main_conf_t)); 715 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_log_main_conf_t));
716 if (conf == NULL) { 716 if (conf == NULL) {
717 return NGX_CONF_ERROR; 717 return NULL;
718 } 718 }
719 719
720 if (ngx_array_init(&conf->formats, cf->pool, 4, sizeof(ngx_http_log_fmt_t)) 720 if (ngx_array_init(&conf->formats, cf->pool, 4, sizeof(ngx_http_log_fmt_t))
721 != NGX_OK) 721 != NGX_OK)
722 { 722 {
723 return NGX_CONF_ERROR; 723 return NULL;
724 } 724 }
725 725
726 fmt = ngx_array_push(&conf->formats); 726 fmt = ngx_array_push(&conf->formats);
727 if (fmt == NULL) { 727 if (fmt == NULL) {
728 return NGX_CONF_ERROR; 728 return NULL;
729 } 729 }
730 730
731 fmt->name.len = sizeof("combined") - 1; 731 fmt->name.len = sizeof("combined") - 1;
732 fmt->name.data = (u_char *) "combined"; 732 fmt->name.data = (u_char *) "combined";
733 733
734 fmt->flushes = NULL; 734 fmt->flushes = NULL;
735 735
736 fmt->ops = ngx_array_create(cf->pool, 16, sizeof(ngx_http_log_op_t)); 736 fmt->ops = ngx_array_create(cf->pool, 16, sizeof(ngx_http_log_op_t));
737 if (fmt->ops == NULL) { 737 if (fmt->ops == NULL) {
738 return NGX_CONF_ERROR; 738 return NULL;
739 } 739 }
740 740
741 return conf; 741 return conf;
742 } 742 }
743 743
747 { 747 {
748 ngx_http_log_loc_conf_t *conf; 748 ngx_http_log_loc_conf_t *conf;
749 749
750 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_log_loc_conf_t)); 750 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_log_loc_conf_t));
751 if (conf == NULL) { 751 if (conf == NULL) {
752 return NGX_CONF_ERROR; 752 return NULL;
753 } 753 }
754 754
755 conf->open_file_cache = NGX_CONF_UNSET_PTR; 755 conf->open_file_cache = NGX_CONF_UNSET_PTR;
756 756
757 return conf; 757 return conf;