check for malloc failure
authorjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Sat, 23 Jun 2007 04:24:48 +0000 (04:24 +0000)
committerjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Sat, 23 Jun 2007 04:24:48 +0000 (04:24 +0000)
git-svn-id: http://svn.xiph.org/trunk/speex@13177 0101bb08-14d6-0310-b084-bc0e0c8e3800

src/speexenc.c

index e251b9b..b5d22e0 100644 (file)
@@ -949,6 +949,8 @@ void comment_init(char **comments, int* length, char *vendor_string)
   int len=4+vendor_length+4;
   char *p=(char*)malloc(len);
   if(p==NULL){
+     fprintf (stderr, "malloc failed in comment_init()\n");
+     exit(1);
   }
   writeint(p, 0, vendor_length);
   memcpy(p+4, vendor_string, vendor_length);
@@ -967,6 +969,8 @@ void comment_add(char **comments, int* length, char *tag, char *val)
 
   p=(char*)realloc(p, len);
   if(p==NULL){
+     fprintf (stderr, "malloc failed in comment_init()\n");
+     exit(1);
   }
 
   writeint(p, *length, tag_len+val_len);      /* length of comment */