avconv: free packet in write_frame() when discarding due to frame number limit
authorJustin Ruggles <justin.ruggles@gmail.com>
Tue, 20 Mar 2012 19:36:28 +0000 (15:36 -0400)
committerJustin Ruggles <justin.ruggles@gmail.com>
Tue, 20 Mar 2012 19:51:58 +0000 (15:51 -0400)
Fixes a memleak when using the -frames option with audio.

avconv.c

index affb877..9a3c75d 100644 (file)
--- 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)) {
      * 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;
             return;
+        }
         ost->frame_number++;
     }
 
         ost->frame_number++;
     }