> 在 2019年9月11日,下午8:36,Andreas Rheinhardt <andreas.rheinha...@gmail.com> 写道: > > This commit fixes a memleak in the hls muxer when one uses a single file > as output. It has been forgotten to free the temporary buffers used to write > the packets so that the size of the leaks basically amounts to the size > of the output file. This commit adds the necessary free. > > Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@gmail.com> > --- > I used av_freep instead of av_free (as happens in other places) in order > not to leave an inconsistent state behind. There is actually no reason > to keep the pointer to the temporary buffer; an automatic variable would > be enough. > Furthermore, if flush_dynbuf fails at opening a new dynamic buffer, the > temporary buffer needs to be freed nevertheless. Yet this isn't done for > the other two calls to flush_dynbuf. > > libavformat/hlsenc.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c > index f881bb9d60..a6a3947ac7 100644 > --- a/libavformat/hlsenc.c > +++ b/libavformat/hlsenc.c > @@ -2365,6 +2365,7 @@ static int hls_write_packet(AVFormatContext *s, > AVPacket *pkt) > > if (hls->flags & HLS_SINGLE_FILE) { > ret = flush_dynbuf(vs, &range_length); > + av_freep(&vs->temp_buffer); > if (ret < 0) { > return ret; > } > -- > 2.21.0 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
LGTM Thanks Steven _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".