Mercurial > mplayer.hg
changeset 34582:d0617776d506
Check for allocation error.
author | ib |
---|---|
date | Thu, 09 Feb 2012 14:37:06 +0000 |
parents | dba158d9b986 |
children | 8e4cafa03bd4 |
files | gui/cfg.c |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/cfg.c Thu Feb 09 14:26:12 2012 +0000 +++ b/gui/cfg.c Thu Feb 09 14:37:06 2012 +0000 @@ -277,6 +277,12 @@ 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 @@ 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); }