diff options
author | Johann Koenig <johannkoenig@google.com> | 2018-09-21 22:36:53 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-09-21 22:36:53 +0000 |
commit | 51dac6d7745ad10c1e864f01819ecacd5c4677d9 (patch) | |
tree | 6136f063704146480bf6265fe8ef662fae15a8c7 /vp9/encoder/vp9_encoder.c | |
parent | 0a6278b95a6bd1c166be124eb65e4ad80d61354b (diff) | |
parent | e376f1d5d4f1c3c39cb1f06cf17020300eac64ea (diff) | |
download | libvpx-51dac6d7745ad10c1e864f01819ecacd5c4677d9.tar libvpx-51dac6d7745ad10c1e864f01819ecacd5c4677d9.tar.gz libvpx-51dac6d7745ad10c1e864f01819ecacd5c4677d9.tar.bz2 libvpx-51dac6d7745ad10c1e864f01819ecacd5c4677d9.zip |
Merge "internal stats: fix mem leak and initialize memory"
Diffstat (limited to 'vp9/encoder/vp9_encoder.c')
-rw-r--r-- | vp9/encoder/vp9_encoder.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 6a200fe29..2f8e73657 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -2236,9 +2236,11 @@ VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf, if (cpi->b_calculate_consistency) { CHECK_MEM_ERROR(cm, cpi->ssim_vars, - vpx_malloc(sizeof(*cpi->ssim_vars) * 4 * - cpi->common.mi_rows * cpi->common.mi_cols)); + vpx_calloc(cpi->common.mi_rows * cpi->common.mi_cols, + sizeof(*cpi->ssim_vars) * 4)); cpi->worst_consistency = 100.0; + } else { + cpi->ssim_vars = NULL; } #endif @@ -2466,6 +2468,10 @@ void vp9_remove_compressor(VP9_COMP *cpi) { if (!cpi) return; +#if CONFIG_INTERNAL_STATS + vpx_free(cpi->ssim_vars); +#endif + cm = &cpi->common; if (cm->current_video_frame > 0) { #if CONFIG_INTERNAL_STATS @@ -2537,7 +2543,6 @@ void vp9_remove_compressor(VP9_COMP *cpi) { fclose(f); } - #endif #if 0 |