changeset 5469:469e891e9630

don't alloc/free NULL
author arpi
date Wed, 03 Apr 2002 15:40:13 +0000
parents b0d37b8ff4b4
children e80d66b5e4a7
files libmpdemux/demuxer.c libmpdemux/demuxer.h
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demuxer.c	Wed Apr 03 11:54:14 2002 +0000
+++ b/libmpdemux/demuxer.c	Wed Apr 03 15:40:13 2002 +0000
@@ -347,7 +347,7 @@
   demux_packet_t *dp=ds->first;
   while(dp){
     demux_packet_t *dn=dp->next;
-    free(dp->buffer);
+    if(dp->buffer) free(dp->buffer);
     free(dp);
     dp=dn;
   }
--- a/libmpdemux/demuxer.h	Wed Apr 03 11:54:14 2002 +0000
+++ b/libmpdemux/demuxer.h	Wed Apr 03 15:40:13 2002 +0000
@@ -118,7 +118,7 @@
 inline static demux_packet_t* new_demux_packet(int len){
   demux_packet_t* dp=malloc(sizeof(demux_packet_t));
   dp->len=len;
-  dp->buffer=malloc(len);
+  dp->buffer=len?malloc(len):NULL;
   dp->next=NULL;
   dp->pts=0;
   dp->pos=0;