Ticket #1320: mod_simple_vhost-calloc-return-value-checks.patch

File mod_simple_vhost-calloc-return-value-checks.patch, 1.0 kB (added by Safari, 13 months ago)
  • src/mod_simple_vhost.c

     
    4343        UNUSED(srv); 
    4444 
    4545        p = calloc(1, sizeof(*p)); 
     46        if (p == NULL) 
     47                return NULL; 
    4648 
    4749        p->doc_root = buffer_init(); 
    4850 
     
    9799        if (!p) return HANDLER_ERROR; 
    98100 
    99101        p->config_storage = calloc(1, srv->config_context->used * sizeof(specific_config *)); 
     102        if (p->config_storage == NULL) 
     103                return HANDLER_ERROR; 
    100104 
    101105        for (i = 0; i < srv->config_context->used; i++) { 
    102106                plugin_config *s; 
    103107 
    104108                s = calloc(1, sizeof(plugin_config)); 
     109                if (s == NULL) 
     110                        return HANDLER_ERROR; 
    105111 
    106112                s->server_root = buffer_init(); 
    107113                s->default_host = buffer_init(); 
     
    225231        plugin_data *p = p_data; 
    226232 
    227233        /* 
    228          * cache the last successfull translation from hostname (authority) to docroot 
     234         * cache the last successful translation from hostname (authority) to docroot 
    229235         * - this saves us a stat() call 
    230236         * 
    231237         */