diff h264.c @ 9380:54e650136c87 libavcodec

Add a ff_h264_free_context function and call it from the H.264 parser. This ensures that the parser will no longer leak memory for all SPS/PPS it encounters.
author reimar
date Fri, 10 Apr 2009 07:01:55 +0000
parents 54bc8a2727b0
children 828d15d322ed
line wrap: on
line diff
--- a/h264.c	Fri Apr 10 00:09:07 2009 +0000
+++ b/h264.c	Fri Apr 10 07:01:55 2009 +0000
@@ -8083,10 +8083,8 @@
 #endif /* TEST */
 
 
-static av_cold int decode_end(AVCodecContext *avctx)
+av_cold ff_h264_free_context(H264Context *h)
 {
-    H264Context *h = avctx->priv_data;
-    MpegEncContext *s = &h->s;
     int i;
 
     av_freep(&h->rbsp_buffer[0]);
@@ -8098,6 +8096,14 @@
 
     for(i = 0; i < MAX_PPS_COUNT; i++)
         av_freep(h->pps_buffers + i);
+}
+
+static av_cold int decode_end(AVCodecContext *avctx)
+{
+    H264Context *h = avctx->priv_data;
+    MpegEncContext *s = &h->s;
+
+    ff_h264_free_context(h);
 
     MPV_common_end(s);