changeset 28320:aac3629b180d

Actually abort (return NULL) in the alloc-failure check in play_tree_new instead of going right ahead and crashing. Patch by Luis Felipe Strano Moraes (luis strano gmail com).
author reimar
date Sun, 25 Jan 2009 18:25:11 +0000
parents 0c7a9144e5f0
children 1dc02f91a9b4
files playtree.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/playtree.c	Sun Jan 25 18:23:05 2009 +0000
+++ b/playtree.c	Sun Jan 25 18:25:11 2009 +0000
@@ -21,8 +21,10 @@
 play_tree_t*
 play_tree_new(void) {
   play_tree_t* r = calloc(1,sizeof(play_tree_t));
-  if(r == NULL)
+  if(r == NULL) {
     mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Can't allocate %d bytes of memory\n",(int)sizeof(play_tree_t));
+    return NULL;
+  }
   r->entry_type = PLAY_TREE_ENTRY_NODE;
   return r;
 }