diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2009-04-11 22:38:00 +0000 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2009-04-11 22:38:00 +0000 |
commit | d2e63e8b0553d400f81285d354f85e778d1cf888 (patch) | |
tree | e0b4925e3276c57e04d0f2f79f37d6626aaa369a | |
parent | 031e14ea79eea52987d0abc91b10ab6e398842aa (diff) | |
download | ffmpeg-streaming-d2e63e8b0553d400f81285d354f85e778d1cf888.zip ffmpeg-streaming-d2e63e8b0553d400f81285d354f85e778d1cf888.tar.gz |
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
-rw-r--r-- | libavformat/utils.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 535da98..0dec40f 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2613,10 +2613,8 @@ void ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt, 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){ |