]> granicus.if.org Git - libvpx/commitdiff
mem leak fix for cpi->tplist
authorJames Berry <jamesberry@google.com>
Mon, 14 Feb 2011 19:02:52 +0000 (14:02 -0500)
committerJames Berry <jamesberry@google.com>
Mon, 14 Feb 2011 19:02:52 +0000 (14:02 -0500)
checks added to make sure that cpi->tplist
is freed correctly in vp8_dealloc_compressor_data
and vp8_alloc_compressor_data.

Change-Id: I66149dbbd25c958800ad94f4379d723191d9680d

vp8/encoder/onyx_if.c

index e73e41ee7c4134b1b4012bbb4820bb4adb9be071..3f787d6da37887ec978730fa26e83aa083fea8ed 100644 (file)
@@ -262,7 +262,8 @@ static void setup_features(VP8_COMP *cpi)
 
 void vp8_dealloc_compressor_data(VP8_COMP *cpi)
 {
-    vpx_free(cpi->tplist);
+    if(cpi->tplist!=0)
+        vpx_free(cpi->tplist);
     cpi->tplist = NULL;
 
     // Delete last frame MV storage buffers
@@ -1406,6 +1407,9 @@ void vp8_alloc_compressor_data(VP8_COMP *cpi)
         cpi->mt_sync_range = 16;
 #endif
 
+    if(cpi->tplist);
+        vpx_free(cpi->tplist);
+
     CHECK_MEM_ERROR(cpi->tplist, vpx_malloc(sizeof(TOKENLIST) * cpi->common.mb_rows));
 }