changeset 4856:c61f423b492c libavformat

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.
author reimar
date Sat, 11 Apr 2009 22:38:00 +0000
parents adec0fc30104
children 18acfe3fe3d5
files utils.c
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/utils.c	Sat Apr 11 21:45:57 2009 +0000
+++ b/utils.c	Sat Apr 11 22:38:00 2009 +0000
@@ -2613,10 +2613,8 @@
 
     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){