src/server/config/mimeconf.c

changeset 658
7290604d846d
parent 579
e10457d74fe1
equal deleted inserted replaced
657:f1469e3144a7 658:7290604d846d
42 ws_cfg_log(LOG_FAILURE, "Cannot load mime config file %s: %s", file, strerror(errno)); 42 ws_cfg_log(LOG_FAILURE, "Cannot load mime config file %s: %s", file, strerror(errno));
43 return NULL; 43 return NULL;
44 } 44 }
45 45
46 MimeConfig *conf = malloc(sizeof(MimeConfig)); 46 MimeConfig *conf = malloc(sizeof(MimeConfig));
47 if(!conf) {
48 return NULL;
49 }
50 memset(conf, 0, sizeof(MimeConfig));
47 conf->parser.parse = mimeconf_parse; 51 conf->parser.parse = mimeconf_parse;
48 conf->directives_begin = NULL; 52 conf->directives_begin = NULL;
49 conf->directives_end = NULL; 53 conf->directives_end = NULL;
50 conf->ntypes = 0; 54 conf->ntypes = 0;
51 int r = cfg_parse_basic_file((ConfigParser*)conf, in); 55 int r = cfg_parse_basic_file((ConfigParser*)conf, in);
52 if(r != 0) { 56 if(r != 0) {
53 ws_cfg_log(LOG_FAILURE, "Cannot parse mime config file %s", file); 57 ws_cfg_log(LOG_FAILURE, "Cannot parse mime config file %s", file);
54 fclose(in); 58 fclose(in);
59 free_mime_config(conf);
55 free(conf); 60 free(conf);
56 // TODO: free
57 return NULL; 61 return NULL;
58 } 62 }
59 63
60 fclose(in); 64 fclose(in);
61 65

mercurial