[Mplayer-cvslog] CVS: main/libmpdemux demux_mov.c,1.76,1.77

Arpi of Ize arpi at mplayerhq.hu
Wed Oct 16 22:14:48 CEST 2002


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv31297

Modified Files:
	demux_mov.c 
Log Message:
memleak fix (found by valgrind)


Index: demux_mov.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mov.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -r1.76 -r1.77
--- demux_mov.c	16 Oct 2002 16:51:02 -0000	1.76
+++ demux_mov.c	16 Oct 2002 20:14:29 -0000	1.77
@@ -286,7 +286,6 @@
     mp_msg(MSGT_DEMUX,MSGL_V,"Checking for MOV\n");
     
     memset(priv,0,sizeof(mov_priv_t));
-    demuxer->priv=priv;
     
     while(1){
 	int skipped=8;
@@ -374,7 +373,7 @@
 	  /* dunno what, but we shoudl ignore it */
 	  break;
 	default:
-	  if(no==0) return 0; // first chunk is bad!
+	  if(no==0){ free(priv); return 0;} // first chunk is bad!
 	  id = be2me_32(id);
 	  mp_msg(MSGT_DEMUX,MSGL_V,"MOV: unknown chunk: %.4s %d\n",&id,(int)len);
 	}
@@ -382,13 +381,19 @@
 	if(!stream_skip(demuxer->stream,len-skipped)) break;
 	++no;
     }
-    
+
+    if(flags==3){
+	demuxer->priv=priv;
+	return 1;
+    }
+    free(priv);
+
     if(flags==1)
 	mp_msg(MSGT_DEMUX,MSGL_WARN,"MOV: missing data (mdat) chunk! Maybe broken file...\n");
     else if(flags==2)
 	mp_msg(MSGT_DEMUX,MSGL_WARN,"MOV: missing header (moov/cmov) chunk! Maybe broken file...\n");
 
-return (flags==3);
+    return 0;
 }
 
 static void lschunks(demuxer_t* demuxer,int level,off_t endpos,mov_track_t* trak){




More information about the MPlayer-cvslog mailing list