On Sun, Nov 1, 2015 at 12:57 PM, wm4 <nfx...@googlemail.com> wrote: > On Sun, 1 Nov 2015 11:21:26 +0100 > Hendrik Leppkes <h.lepp...@gmail.com> wrote: > >> This fixes a memory leak when side-data is present. >> --- >> libavformat/utils.c | 9 ++++----- >> 1 file changed, 4 insertions(+), 5 deletions(-) >> >> diff --git a/libavformat/utils.c b/libavformat/utils.c >> index 7e4f54f..3f82659 100644 >> --- a/libavformat/utils.c >> +++ b/libavformat/utils.c >> @@ -1285,12 +1285,11 @@ static int parse_packet(AVFormatContext *s, AVPacket >> *pkt, int stream_index) >> >> compute_pkt_fields(s, st, st->parser, &out_pkt, next_dts, next_pts); >> >> - if ((ret = add_to_pktbuf(&s->internal->parse_queue, &out_pkt, >> - &s->internal->parse_queue_end, >> - 1))) { >> - av_packet_unref(&out_pkt); >> + ret = add_to_pktbuf(&s->internal->parse_queue, &out_pkt, >> + &s->internal->parse_queue_end, 1); >> + av_packet_unref(&out_pkt); >> + if (ret < 0) >> goto fail; >> - } >> } >> >> /* end of the stream => close and free the parser */ > > I thought he semantics of add_to_pktbuf was to transfer packet > ownership if the last parameter is 1?
Actually 0 does that, 1 creates a new reference, including copying data into a refcounted buffer if needed, which is wanted here since the output buffer from the parser is not persistent otherwise. - Hendrik _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel