summaryrefslogtreecommitdiff
path: root/vpx/src/vpx_encoder.c
diff options
context:
space:
mode:
authorJerome Jiang <jianj@google.com>2019-06-14 09:50:30 -0700
committerJerome Jiang <jianj@google.com>2019-06-14 10:13:26 -0700
commitc06a917501294f8845df580b114a13fce7269b2f (patch)
tree9b55c6f0c35cff51d07e1e9cb4610e83fa5a5eb8 /vpx/src/vpx_encoder.c
parentcb2edce5e2632dfb44bc638094d1fe294caff50b (diff)
downloadlibvpx-c06a917501294f8845df580b114a13fce7269b2f.tar
libvpx-c06a917501294f8845df580b114a13fce7269b2f.tar.gz
libvpx-c06a917501294f8845df580b114a13fce7269b2f.tar.bz2
libvpx-c06a917501294f8845df580b114a13fce7269b2f.zip
Fix memory leak for vp8 multi-res encoder.
BUG=webm:1630 Change-Id: I03e74e78aa0ead66eda7506e921b1774b5442ed5
Diffstat (limited to 'vpx/src/vpx_encoder.c')
-rw-r--r--vpx/src/vpx_encoder.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/vpx/src/vpx_encoder.c b/vpx/src/vpx_encoder.c
index 3385c22c0..f38577de6 100644
--- a/vpx/src/vpx_encoder.c
+++ b/vpx/src/vpx_encoder.c
@@ -82,6 +82,9 @@ vpx_codec_err_t vpx_codec_enc_init_multi_ver(
res = VPX_CODEC_INCAPABLE;
else {
int i;
+#if CONFIG_MULTI_RES_ENCODING
+ int mem_loc_owned = 0;
+#endif
void *mem_loc = NULL;
if (iface->enc.mr_get_mem_loc == NULL) return VPX_CODEC_INCAPABLE;
@@ -129,13 +132,17 @@ vpx_codec_err_t vpx_codec_enc_init_multi_ver(
i--;
}
#if CONFIG_MULTI_RES_ENCODING
- assert(mem_loc);
- free(((LOWER_RES_FRAME_INFO *)mem_loc)->mb_info);
- free(mem_loc);
+ if (!mem_loc_owned) {
+ assert(mem_loc);
+ free(((LOWER_RES_FRAME_INFO *)mem_loc)->mb_info);
+ free(mem_loc);
+ }
#endif
return SAVE_STATUS(ctx, res);
}
-
+#if CONFIG_MULTI_RES_ENCODING
+ mem_loc_owned = 1;
+#endif
ctx++;
cfg++;
dsf++;