comparison gui/cfg.c @ 34582:d0617776d506

Check for allocation error.
author ib
date Thu, 09 Feb 2012 14:37:06 +0000
parents dba158d9b986
children 8e4cafa03bd4
comparison
equal deleted inserted replaced
34581:dba158d9b986 34582:d0617776d506
275 if (file) { 275 if (file) {
276 while (fgetstr(line, sizeof(line), file)) { 276 while (fgetstr(line, sizeof(line), file)) {
277 plItem *item; 277 plItem *item;
278 278
279 item = calloc(1, sizeof(plItem)); 279 item = calloc(1, sizeof(plItem));
280
281 if (!item) {
282 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_MemAllocFailed);
283 mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
284 }
285
280 item->path = strdup(line); 286 item->path = strdup(line);
281 fgetstr(line, sizeof(line), file); 287 fgetstr(line, sizeof(line), file);
282 item->name = strdup(line); 288 item->name = strdup(line);
283 listSet(gtkAddPlItem, item); 289 listSet(gtkAddPlItem, item);
284 } 290 }
296 if (file) { 302 if (file) {
297 while (fgetstr(line, sizeof(line), file)) { 303 while (fgetstr(line, sizeof(line), file)) {
298 urlItem *item; 304 urlItem *item;
299 305
300 item = calloc(1, sizeof(urlItem)); 306 item = calloc(1, sizeof(urlItem));
307
308 if (!item) {
309 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_MemAllocFailed);
310 mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
311 }
312
301 item->url = strdup(line); 313 item->url = strdup(line);
302 listSet(gtkAddURLItem, item); 314 listSet(gtkAddURLItem, item);
303 } 315 }
304 316
305 fclose(file); 317 fclose(file);