diff playtree.c @ 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 26c73d63f619
children 0f1b5b68af32
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;
 }