summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2012-01-17 20:55:54 +0100
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2012-01-17 22:16:07 +0100
commitd393f41a33abc093a6a5ca1999e6c2515a86498a (patch)
tree03b755ebabcd342d33852879e14c74dc5e9f905e /ffmpeg.c
parent178f8ea76e52f79e2b7f4a01973d11f5c518f915 (diff)
Fix memleak after switch to encode_audio2 API.
Obviously the packet allocated by the encoder must be freed somewhere. Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index b9297df6f4..ba8dfc98fa 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,