diff options
author | Jim Bankoski <jimbankoski@google.com> | 2012-09-11 16:30:19 -0700 |
---|---|---|
committer | Jim Bankoski <jimbankoski@google.com> | 2012-09-11 16:34:36 -0700 |
commit | 7b7ca65bfc15b1dc47a0f1063b66d0e85fba849b (patch) | |
tree | 828a05e9e5ffa6bb0ce61bea9a60ef5252c58f7f | |
parent | 2ff6d35064919a8ad9e56150a19dc7ccd3ec2e7e (diff) | |
download | libvpx-7b7ca65bfc15b1dc47a0f1063b66d0e85fba849b.tar libvpx-7b7ca65bfc15b1dc47a0f1063b66d0e85fba849b.tar.gz libvpx-7b7ca65bfc15b1dc47a0f1063b66d0e85fba849b.tar.bz2 libvpx-7b7ca65bfc15b1dc47a0f1063b66d0e85fba849b.zip |
fix valgrind mem leak on garbage decode
Multiple decoders were getting allocated per frame.
If the decoder crashed we exitted with out freeing
them and the next time in we'd allocate over.
This fix removes the allocation and just has 8
boolcoders in the pbi structure
Change-Id: I638b5bda23b622b43b7992aec21dd7cf6f6278da
-rw-r--r-- | vp8/decoder/decodframe.c | 16 | ||||
-rw-r--r-- | vp8/decoder/onyxd_if.c | 1 | ||||
-rw-r--r-- | vp8/decoder/onyxd_int.h | 2 |
3 files changed, 2 insertions, 17 deletions
diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c index 1a462a2cc..ea8798f47 100644 --- a/vp8/decoder/decodframe.c +++ b/vp8/decoder/decodframe.c @@ -831,9 +831,7 @@ static void setup_token_decoder(VP8D_COMP *pbi, num_token_partitions = 1 << pbi->common.multi_token_partition; if (num_token_partitions > 1) { - CHECK_MEM_ERROR(pbi->mbc, vpx_malloc(num_token_partitions * - sizeof(vp8_reader))); - bool_decoder = pbi->mbc; + bool_decoder = &pbi->mbc[0]; } /* Check for partitions within the fragments and unpack the fragments @@ -907,16 +905,6 @@ static void setup_token_decoder(VP8D_COMP *pbi, #endif } -static void stop_token_decoder(VP8D_COMP *pbi) -{ - VP8_COMMON *pc = &pbi->common; - - if (pc->multi_token_partition != ONE_PARTITION) - { - vpx_free(pbi->mbc); - pbi->mbc = NULL; - } -} static void init_frame(VP8D_COMP *pbi) { @@ -1441,8 +1429,6 @@ int vp8_decode_frame(VP8D_COMP *pbi) corrupt_tokens |= xd->corrupted; } - stop_token_decoder(pbi); - /* Collect information about decoder corruption. */ /* 1. Check first boolean decoder for errors. */ pc->yv12_fb[pc->new_fb_idx].corrupted = vp8dx_bool_error(bc); diff --git a/vp8/decoder/onyxd_if.c b/vp8/decoder/onyxd_if.c index 205c150bd..95293f421 100644 --- a/vp8/decoder/onyxd_if.c +++ b/vp8/decoder/onyxd_if.c @@ -120,7 +120,6 @@ void vp8dx_remove_decompressor(VP8D_COMP *pbi) vp8_de_alloc_overlap_lists(pbi); #endif vp8_remove_common(&pbi->common); - vpx_free(pbi->mbc); vpx_free(pbi); } diff --git a/vp8/decoder/onyxd_int.h b/vp8/decoder/onyxd_int.h index 240f5f727..e6c814acc 100644 --- a/vp8/decoder/onyxd_int.h +++ b/vp8/decoder/onyxd_int.h @@ -77,7 +77,7 @@ typedef struct VP8D_COMP /* end of threading data */ #endif - vp8_reader *mbc; + vp8_reader mbc[8]; int64_t last_time_stamp; int ready_for_new_data; |