comparison main.c @ 135:eaae8014a94a

Don't assert and leak memory if failing during argument collection. Once you have a -D option or a -include foo option, you need to clean up the arrays those are accumulated in if you die before they're collected and handled.
author David A. Holland
date Tue, 09 Jul 2013 13:35:40 -0400
parents 64c4de3709de
children 59680a727e9d
comparison
equal deleted inserted replaced
134:b17209c1ced5 135:eaae8014a94a
106 106
107 static 107 static
108 void 108 void
109 commandline_macros_cleanup(void) 109 commandline_macros_cleanup(void)
110 { 110 {
111 unsigned i, num;
112 struct commandline_macro *cm;
113
114 num = array_num(&commandline_macros);
115 for (i=0; i<num; i++) {
116 cm = array_get(&commandline_macros, i);
117 dofree(cm, sizeof(*cm));
118 }
119 array_setsize(&commandline_macros, 0);
120
111 array_cleanup(&commandline_macros); 121 array_cleanup(&commandline_macros);
112 } 122 }
113 123
114 static 124 static
115 void 125 void
250 260
251 static 261 static
252 void 262 void
253 commandline_files_cleanup(void) 263 commandline_files_cleanup(void)
254 { 264 {
265 unsigned i, num;
266 struct commandline_file *cf;
267
268 num = array_num(&commandline_files);
269 for (i=0; i<num; i++) {
270 cf = array_get(&commandline_files, i);
271 dofree(cf, sizeof(*cf));
272 }
273 array_setsize(&commandline_files, 0);
274
255 array_cleanup(&commandline_files); 275 array_cleanup(&commandline_files);
256 } 276 }
257 277
258 static 278 static
259 void 279 void