]> git.sesse.net Git - nageru/blobdiff - h264encode.cpp
Fix a memory leak in audio encoding.
[nageru] / 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