Klaus Demo nginx / 260c432
return NULL instead of NGX_CONF_ERROR on a create conf failure Igor Sysoev 13 years ago
44 changed file(s) with 64 addition(s) and 64 deletion(s). Raw diff Collapse all Expand all
215215
216216 if (module->create_conf) {
217217 rv = module->create_conf(cycle);
218 if (rv == NGX_CONF_ERROR) {
218 if (rv == NULL) {
219219 ngx_destroy_pool(pool);
220220 return NULL;
221221 }
549549
550550 dpcf = ngx_palloc(cycle->pool, sizeof(ngx_devpoll_conf_t));
551551 if (dpcf == NULL) {
552 return NGX_CONF_ERROR;
552 return NULL;
553553 }
554554
555555 dpcf->changes = NGX_CONF_UNSET;
551551
552552 epcf = ngx_palloc(cycle->pool, sizeof(ngx_epoll_conf_t));
553553 if (epcf == NULL) {
554 return NGX_CONF_ERROR;
554 return NULL;
555555 }
556556
557557 epcf->events = NGX_CONF_UNSET;
580580
581581 epcf = ngx_palloc(cycle->pool, sizeof(ngx_eventport_conf_t));
582582 if (epcf == NULL) {
583 return NGX_CONF_ERROR;
583 return NULL;
584584 }
585585
586586 epcf->events = NGX_CONF_UNSET;
767767
768768 kcf = ngx_palloc(cycle->pool, sizeof(ngx_kqueue_conf_t));
769769 if (kcf == NULL) {
770 return NGX_CONF_ERROR;
770 return NULL;
771771 }
772772
773773 kcf->changes = NGX_CONF_UNSET;
690690
691691 rtscf = ngx_palloc(cycle->pool, sizeof(ngx_rtsig_conf_t));
692692 if (rtscf == NULL) {
693 return NGX_CONF_ERROR;
693 return NULL;
694694 }
695695
696696 rtscf->signo = NGX_CONF_UNSET;
11121112
11131113 ecf = ngx_palloc(cycle->pool, sizeof(ngx_event_conf_t));
11141114 if (ecf == NULL) {
1115 return NGX_CONF_ERROR;
1115 return NULL;
11161116 }
11171117
11181118 ecf->connections = NGX_CONF_UNSET_UINT;
11271127 if (ngx_array_init(&ecf->debug_connection, cycle->pool, 4,
11281128 sizeof(ngx_event_debug_t)) == NGX_ERROR)
11291129 {
1130 return NGX_CONF_ERROR;
1130 return NULL;
11311131 }
11321132
11331133 #endif
21142114
21152115 oscf = ngx_pcalloc(cycle->pool, sizeof(ngx_openssl_conf_t));
21162116 if (oscf == NULL) {
2117 return NGX_CONF_ERROR;
2117 return NULL;
21182118 }
21192119
21202120 /*
200200
201201 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_access_loc_conf_t));
202202 if (conf == NULL) {
203 return NGX_CONF_ERROR;
203 return NULL;
204204 }
205205
206206 return conf;
211211
212212 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_addition_conf_t));
213213 if (conf == NULL) {
214 return NGX_CONF_ERROR;
214 return NULL;
215215 }
216216
217217 /*
371371
372372 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_auth_basic_loc_conf_t));
373373 if (conf == NULL) {
374 return NGX_CONF_ERROR;
374 return NULL;
375375 }
376376
377377 return conf;
631631
632632 conf = ngx_palloc(cf->pool, sizeof(ngx_http_autoindex_loc_conf_t));
633633 if (conf == NULL) {
634 return NGX_CONF_ERROR;
634 return NULL;
635635 }
636636
637637 conf->enable = NGX_CONF_UNSET;
422422
423423 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_browser_conf_t));
424424 if (conf == NULL) {
425 return NGX_CONF_ERROR;
425 return NULL;
426426 }
427427
428428 /*
14871487
14881488 mcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_charset_main_conf_t));
14891489 if (mcf == NULL) {
1490 return NGX_CONF_ERROR;
1490 return NULL;
14911491 }
14921492
14931493 if (ngx_array_init(&mcf->charsets, cf->pool, 2, sizeof(ngx_http_charset_t))
14941494 != NGX_OK)
14951495 {
1496 return NGX_CONF_ERROR;
1496 return NULL;
14971497 }
14981498
14991499 if (ngx_array_init(&mcf->tables, cf->pool, 1,
15001500 sizeof(ngx_http_charset_tables_t))
15011501 != NGX_OK)
15021502 {
1503 return NGX_CONF_ERROR;
1503 return NULL;
15041504 }
15051505
15061506 if (ngx_array_init(&mcf->recodes, cf->pool, 2,
15071507 sizeof(ngx_http_charset_recode_t))
15081508 != NGX_OK)
15091509 {
1510 return NGX_CONF_ERROR;
1510 return NULL;
15111511 }
15121512
15131513 return mcf;
15211521
15221522 lcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_charset_loc_conf_t));
15231523 if (lcf == NULL) {
1524 return NGX_CONF_ERROR;
1524 return NULL;
15251525 }
15261526
15271527 /*
11531153
11541154 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_dav_loc_conf_t));
11551155 if (conf == NULL) {
1156 return NGX_CONF_ERROR;
1156 return NULL;
11571157 }
11581158
11591159 /*
18321832
18331833 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_fastcgi_loc_conf_t));
18341834 if (conf == NULL) {
1835 return NGX_CONF_ERROR;
1835 return NULL;
18361836 }
18371837
18381838 /*
10681068
10691069 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_gzip_conf_t));
10701070 if (conf == NULL) {
1071 return NGX_CONF_ERROR;
1071 return NULL;
10721072 }
10731073
10741074 /*
250250
251251 conf = ngx_palloc(cf->pool, sizeof(ngx_http_gzip_static_conf_t));
252252 if (conf == NULL) {
253 return NGX_CONF_ERROR;
253 return NULL;
254254 }
255255
256256 conf->enable = NGX_CONF_UNSET;
420420
421421 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_headers_conf_t));
422422 if (conf == NULL) {
423 return NGX_CONF_ERROR;
423 return NULL;
424424 }
425425
426426 /*
946946
947947 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_image_filter_conf_t));
948948 if (conf == NULL) {
949 return NGX_CONF_ERROR;
949 return NULL;
950950 }
951951
952952 conf->filter = NGX_CONF_UNSET_UINT;
365365
366366 conf = ngx_palloc(cf->pool, sizeof(ngx_http_index_loc_conf_t));
367367 if (conf == NULL) {
368 return NGX_CONF_ERROR;
368 return NULL;
369369 }
370370
371371 conf->indices = NULL;
521521
522522 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_limit_req_conf_t));
523523 if (conf == NULL) {
524 return NGX_CONF_ERROR;
524 return NULL;
525525 }
526526
527527 /*
380380
381381 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_limit_zone_conf_t));
382382 if (conf == NULL) {
383 return NGX_CONF_ERROR;
383 return NULL;
384384 }
385385
386386 /*
713713
714714 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_log_main_conf_t));
715715 if (conf == NULL) {
716 return NGX_CONF_ERROR;
716 return NULL;
717717 }
718718
719719 if (ngx_array_init(&conf->formats, cf->pool, 4, sizeof(ngx_http_log_fmt_t))
720720 != NGX_OK)
721721 {
722 return NGX_CONF_ERROR;
722 return NULL;
723723 }
724724
725725 fmt = ngx_array_push(&conf->formats);
726726 if (fmt == NULL) {
727 return NGX_CONF_ERROR;
727 return NULL;
728728 }
729729
730730 fmt->name.len = sizeof("combined") - 1;
734734
735735 fmt->ops = ngx_array_create(cf->pool, 16, sizeof(ngx_http_log_op_t));
736736 if (fmt->ops == NULL) {
737 return NGX_CONF_ERROR;
737 return NULL;
738738 }
739739
740740 return conf;
748748
749749 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_log_loc_conf_t));
750750 if (conf == NULL) {
751 return NGX_CONF_ERROR;
751 return NULL;
752752 }
753753
754754 conf->open_file_cache = NGX_CONF_UNSET_PTR;
159159
160160 mcf = ngx_palloc(cf->pool, sizeof(ngx_http_map_conf_t));
161161 if (mcf == NULL) {
162 return NGX_CONF_ERROR;
162 return NULL;
163163 }
164164
165165 mcf->hash_max_size = NGX_CONF_UNSET_UINT;
512512
513513 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_memcached_loc_conf_t));
514514 if (conf == NULL) {
515 return NGX_CONF_ERROR;
515 return NULL;
516516 }
517517
518518 /*
18821882
18831883 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_proxy_loc_conf_t));
18841884 if (conf == NULL) {
1885 return NGX_CONF_ERROR;
1885 return NULL;
18861886 }
18871887
18881888 /*
279279
280280 conf = ngx_palloc(cf->pool, sizeof(ngx_http_random_index_loc_conf_t));
281281 if (conf == NULL) {
282 return NGX_CONF_ERROR;
282 return NULL;
283283 }
284284
285285 conf->enable = NGX_CONF_UNSET;
359359
360360 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_realip_loc_conf_t));
361361 if (conf == NULL) {
362 return NGX_CONF_ERROR;
362 return NULL;
363363 }
364364
365365 /*
220220
221221 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_referer_conf_t));
222222 if (conf == NULL) {
223 return NGX_CONF_ERROR;
223 return NULL;
224224 }
225225
226226 #if (NGX_PCRE)
219219
220220 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_rewrite_loc_conf_t));
221221 if (conf == NULL) {
222 return NGX_CONF_ERROR;
222 return NULL;
223223 }
224224
225225 conf->stack_size = NGX_CONF_UNSET_UINT;
151151
152152 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_secure_link_conf_t));
153153 if (conf == NULL) {
154 return NGX_CONF_ERROR;
154 return NULL;
155155 }
156156
157157 /*
26882688
26892689 smcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_ssi_main_conf_t));
26902690 if (smcf == NULL) {
2691 return NGX_CONF_ERROR;
2691 return NULL;
26922692 }
26932693
26942694 smcf->commands.pool = cf->pool;
26952695 smcf->commands.temp_pool = cf->temp_pool;
26962696
26972697 if (ngx_hash_keys_array_init(&smcf->commands, NGX_HASH_SMALL) != NGX_OK) {
2698 return NGX_CONF_ERROR;
2698 return NULL;
26992699 }
27002700
27012701 return smcf;
27352735
27362736 slcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_ssi_loc_conf_t));
27372737 if (slcf == NULL) {
2738 return NGX_CONF_ERROR;
2738 return NULL;
27392739 }
27402740
27412741 /*
301301
302302 sscf = ngx_pcalloc(cf->pool, sizeof(ngx_http_ssl_srv_conf_t));
303303 if (sscf == NULL) {
304 return NGX_CONF_ERROR;
304 return NULL;
305305 }
306306
307307 /*
637637
638638 slcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_sub_loc_conf_t));
639639 if (slcf == NULL) {
640 return NGX_CONF_ERROR;
640 return NULL;
641641 }
642642
643643 /*
569569
570570 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_userid_conf_t));
571571 if (conf == NULL) {
572 return NGX_CONF_ERROR;
572 return NULL;
573573 }
574574
575575 /*
11681168
11691169 conf = ngx_palloc(cf->pool, sizeof(ngx_http_xslt_filter_main_conf_t));
11701170 if (conf == NULL) {
1171 return NGX_CONF_ERROR;
1171 return NULL;
11721172 }
11731173
11741174 if (ngx_array_init(&conf->dtd_files, cf->pool, 1,
11961196
11971197 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_xslt_filter_loc_conf_t));
11981198 if (conf == NULL) {
1199 return NGX_CONF_ERROR;
1199 return NULL;
12001200 }
12011201
12021202 /*
783783
784784 pmcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_perl_main_conf_t));
785785 if (pmcf == NULL) {
786 return NGX_CONF_ERROR;
786 return NULL;
787787 }
788788
789789 if (ngx_array_init(&pmcf->requires, cf->pool, 1, sizeof(u_char *))
868868
869869 plcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_perl_loc_conf_t));
870870 if (plcf == NULL) {
871 return NGX_CONF_ERROR;
871 return NULL;
872872 }
873873
874874 /*
27022702
27032703 cmcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_core_main_conf_t));
27042704 if (cmcf == NULL) {
2705 return NGX_CONF_ERROR;
2705 return NULL;
27062706 }
27072707
27082708 if (ngx_array_init(&cmcf->servers, cf->pool, 4,
27092709 sizeof(ngx_http_core_srv_conf_t *))
27102710 != NGX_OK)
27112711 {
2712 return NGX_CONF_ERROR;
2712 return NULL;
27132713 }
27142714
27152715 cmcf->server_names_hash_max_size = NGX_CONF_UNSET_UINT;
27612761
27622762 cscf = ngx_pcalloc(cf->pool, sizeof(ngx_http_core_srv_conf_t));
27632763 if (cscf == NULL) {
2764 return NGX_CONF_ERROR;
2764 return NULL;
27652765 }
27662766
27672767 /*
27742774 sizeof(ngx_http_listen_t))
27752775 != NGX_OK)
27762776 {
2777 return NGX_CONF_ERROR;
2777 return NULL;
27782778 }
27792779
27802780 if (ngx_array_init(&cscf->server_names, cf->temp_pool, 4,
27812781 sizeof(ngx_http_server_name_t))
27822782 != NGX_OK)
27832783 {
2784 return NGX_CONF_ERROR;
2784 return NULL;
27852785 }
27862786
27872787 cscf->connection_pool_size = NGX_CONF_UNSET_SIZE;
28922892
28932893 lcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_core_loc_conf_t));
28942894 if (lcf == NULL) {
2895 return NGX_CONF_ERROR;
2895 return NULL;
28962896 }
28972897
28982898 /*
41814181 sizeof(ngx_http_upstream_srv_conf_t *))
41824182 != NGX_OK)
41834183 {
4184 return NGX_CONF_ERROR;
4184 return NULL;
41854185 }
41864186
41874187 return umcf;
13011301
13021302 ahcf = ngx_pcalloc(cf->pool, sizeof(ngx_mail_auth_http_conf_t));
13031303 if (ahcf == NULL) {
1304 return NGX_CONF_ERROR;
1304 return NULL;
13051305 }
13061306
13071307 ahcf->timeout = NGX_CONF_UNSET_MSEC;
119119
120120 cmcf = ngx_pcalloc(cf->pool, sizeof(ngx_mail_core_main_conf_t));
121121 if (cmcf == NULL) {
122 return NGX_CONF_ERROR;
122 return NULL;
123123 }
124124
125125 if (ngx_array_init(&cmcf->servers, cf->pool, 4,
126126 sizeof(ngx_mail_core_srv_conf_t *))
127127 != NGX_OK)
128128 {
129 return NGX_CONF_ERROR;
129 return NULL;
130130 }
131131
132132 if (ngx_array_init(&cmcf->listen, cf->pool, 4, sizeof(ngx_mail_listen_t))
133133 != NGX_OK)
134134 {
135 return NGX_CONF_ERROR;
135 return NULL;
136136 }
137137
138138 return cmcf;
10601060
10611061 pcf = ngx_pcalloc(cf->pool, sizeof(ngx_mail_proxy_conf_t));
10621062 if (pcf == NULL) {
1063 return NGX_CONF_ERROR;
1063 return NULL;
10641064 }
10651065
10661066 pcf->enable = NGX_CONF_UNSET;
165165
166166 scf = ngx_pcalloc(cf->pool, sizeof(ngx_mail_ssl_conf_t));
167167 if (scf == NULL) {
168 return NGX_CONF_ERROR;
168 return NULL;
169169 }
170170
171171 /*