[FFmpeg-devel] [PATCH] Fix memleak after switch to encode_audio2 API.
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Tue Jan 17 20:56:46 CET 2012
Obviously the packet allocated by the encoder must be freed somewhere.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
---
ffmpeg.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/ffmpeg.c b/ffmpeg.c
index b9297df..ba8dfc9 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1065,6 +1065,8 @@ static int encode_audio_frame(AVFormatContext *s, OutputStream *ost,
exit_program(1);
}
+ ret = pkt.size;
+
if (got_packet) {
pkt.stream_index = ost->index;
if (pkt.pts != AV_NOPTS_VALUE)
@@ -1075,12 +1077,14 @@ static int encode_audio_frame(AVFormatContext *s, OutputStream *ost,
write_frame(s, &pkt, ost);
audio_size += pkt.size;
+
+ av_free_packet(&pkt);
}
if (frame)
ost->sync_opts += frame->nb_samples;
- return pkt.size;
+ return ret;
}
static void do_audio_out(AVFormatContext *s, OutputStream *ost,
--
1.7.8.3
More information about the ffmpeg-devel
mailing list