[FFmpeg-cvslog] r18452 - trunk/libavformat/utils.c

reimar subversion
Sun Apr 12 00:38:00 CEST 2009


Author: reimar
Date: Sun Apr 12 00:38:00 2009
New Revision: 18452

Log:
Simplify packet duplication code in ff_interleave_add_packet.
Behaviour only changes if pkt->destuct neither av_destruct_packet,
av_destruct_packet_nofree nor NULL, in which case the new code avoids a double free.

Modified:
   trunk/libavformat/utils.c

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	Sun Apr 12 00:04:52 2009	(r18451)
+++ trunk/libavformat/utils.c	Sun Apr 12 00:38:00 2009	(r18452)
@@ -2613,10 +2613,8 @@ void ff_interleave_add_packet(AVFormatCo
 
     this_pktl = av_mallocz(sizeof(AVPacketList));
     this_pktl->pkt= *pkt;
-    if(pkt->destruct == av_destruct_packet)
-        pkt->destruct= NULL; // not shared -> must keep original from being freed
-    else
-        av_dup_packet(&this_pktl->pkt);  //shared -> must dup
+    pkt->destruct= NULL;             // do not free original but only the copy
+    av_dup_packet(&this_pktl->pkt);  // duplicate the packet if it uses non-alloced memory
 
     next_point = &s->packet_buffer;
     while(*next_point){



More information about the ffmpeg-cvslog mailing list