[MPlayer-cvslog] r34670 - trunk/gui/cfg.c

ib subversion at mplayerhq.hu
Thu Feb 9 15:37:06 CET 2012


Author: ib
Date: Thu Feb  9 15:37:06 2012
New Revision: 34670

Log:
Check for allocation error.

Modified:
   trunk/gui/cfg.c

Modified: trunk/gui/cfg.c
==============================================================================
--- trunk/gui/cfg.c	Thu Feb  9 15:26:12 2012	(r34669)
+++ trunk/gui/cfg.c	Thu Feb  9 15:37:06 2012	(r34670)
@@ -277,6 +277,12 @@ void cfg_read(void)
             plItem *item;
 
             item       = calloc(1, sizeof(plItem));
+
+            if (!item) {
+                gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_MemAllocFailed);
+                mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
+            }
+
             item->path = strdup(line);
             fgetstr(line, sizeof(line), file);
             item->name = strdup(line);
@@ -298,6 +304,12 @@ void cfg_read(void)
             urlItem *item;
 
             item      = calloc(1, sizeof(urlItem));
+
+            if (!item) {
+                gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_MemAllocFailed);
+                mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
+            }
+
             item->url = strdup(line);
             listSet(gtkAddURLItem, item);
         }


More information about the MPlayer-cvslog mailing list