]> git.sesse.net Git - nageru/commitdiff
Fix a memory leak in audio encoding.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 17 Apr 2016 22:31:35 +0000 (00:31 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 17 Apr 2016 22:31:35 +0000 (00:31 +0200)
h264encode.cpp

index ae60763a3f0de335704feab7df533729b5d5d941..63ed499eec535900b604fdff06bef9008c783ea4 100644 (file)
@@ -1750,12 +1750,12 @@ void H264EncoderImpl::encode_audio_one_frame(
                        dest->add_packet(pkt, audio_pts + global_delay(), audio_pts + global_delay());
                }
        }
+
+       av_freep(&audio_frame->data[0]);
+
        // TODO: Delayed frames.
        av_frame_unref(audio_frame);
        av_free_packet(&pkt);
-
-       av_freep(&audio_frame->data[0]);
-       av_freep(&audio_frame->linesize[0]);
 }
 
 // this is weird. but it seems to put a new frame onto the queue