summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-03-20 15:36:28 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2012-03-20 15:51:58 -0400
commitc9594fe0fb6dd123fa25cb27fe5bc976ff3a9051 (patch)
tree53b09ddc3eb36cb5356f7ccc6200eef89298a0a6
parente056f8d37dfc1252a288b0272256a7562a870003 (diff)
avconv: free packet in write_frame() when discarding due to frame number limit
Fixes a memleak when using the -frames option with audio.
-rw-r--r--avconv.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/avconv.c b/avconv.c
index affb87742e..9a3c75d59e 100644
--- a/avconv.c
+++ b/avconv.c
@@ -887,8 +887,10 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
* reordering, see do_video_out()
*/
if (!(avctx->codec_type == AVMEDIA_TYPE_VIDEO && avctx->codec)) {
- if (ost->frame_number >= ost->max_frames)
+ if (ost->frame_number >= ost->max_frames) {
+ av_free_packet(pkt);
return;
+ }
ost->frame_number++;
}