changeset 6393:eaa18f140fb7 libavcodec

fix memory leaks in vp3 decoder
author mru
date Sun, 24 Feb 2008 18:56:52 +0000
parents 745d65881f5c
children 1a9af4a496f2
files vp3.c
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/vp3.c	Sun Feb 24 14:47:42 2008 +0000
+++ b/vp3.c	Sun Feb 24 18:56:52 2008 +0000
@@ -2313,7 +2313,9 @@
 static int vp3_decode_end(AVCodecContext *avctx)
 {
     Vp3DecodeContext *s = avctx->priv_data;
-
+    int i;
+
+    av_free(s->superblock_coding);
     av_free(s->all_fragments);
     av_free(s->coeffs);
     av_free(s->coded_fragment_list);
@@ -2322,6 +2324,19 @@
     av_free(s->macroblock_fragments);
     av_free(s->macroblock_coding);
 
+    for (i = 0; i < 16; i++) {
+        free_vlc(&s->dc_vlc[i]);
+        free_vlc(&s->ac_vlc_1[i]);
+        free_vlc(&s->ac_vlc_2[i]);
+        free_vlc(&s->ac_vlc_3[i]);
+        free_vlc(&s->ac_vlc_4[i]);
+    }
+
+    free_vlc(&s->superblock_run_length_vlc);
+    free_vlc(&s->fragment_run_length_vlc);
+    free_vlc(&s->mode_code_vlc);
+    free_vlc(&s->motion_vector_vlc);
+
     /* release all frames */
     if (s->golden_frame.data[0] && s->golden_frame.data[0] != s->last_frame.data[0])
         avctx->release_buffer(avctx, &s->golden_frame);