Commit d2e63e8b authored by Reimar Döffinger's avatar Reimar Döffinger
Browse files

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.

Originally committed as revision 18452 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 031e14ea
...@@ -2613,10 +2613,8 @@ void ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt, ...@@ -2613,10 +2613,8 @@ void ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
this_pktl = av_mallocz(sizeof(AVPacketList)); this_pktl = av_mallocz(sizeof(AVPacketList));
this_pktl->pkt= *pkt; this_pktl->pkt= *pkt;
if(pkt->destruct == av_destruct_packet) pkt->destruct= NULL; // do not free original but only the copy
pkt->destruct= NULL; // not shared -> must keep original from being freed av_dup_packet(&this_pktl->pkt); // duplicate the packet if it uses non-alloced memory
else
av_dup_packet(&this_pktl->pkt); //shared -> must dup
next_point = &s->packet_buffer; next_point = &s->packet_buffer;
while(*next_point){ while(*next_point){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment