diff options
author | Jerome Jiang <jianj@google.com> | 2019-06-06 15:38:13 -0700 |
---|---|---|
committer | Jerome Jiang <jianj@google.com> | 2019-06-06 15:38:13 -0700 |
commit | 28cc5f3646bac9d01e583621f611303f738424f0 (patch) | |
tree | fde33695d470e18932b73a23420bf31d35c8f084 | |
parent | 1140d8f2e200a284b56e3b498e4cad0ce8e5d1d2 (diff) | |
download | libvpx-28cc5f3646bac9d01e583621f611303f738424f0.tar libvpx-28cc5f3646bac9d01e583621f611303f738424f0.tar.gz libvpx-28cc5f3646bac9d01e583621f611303f738424f0.tar.bz2 libvpx-28cc5f3646bac9d01e583621f611303f738424f0.zip |
vp8: fix leak in vp8e_mr_alloc_mem
BUG=webm:1596
Change-Id: I09ba00a7b7ad331671a7a285a2ac5630d8b62199
-rw-r--r-- | vp8/vp8_cx_iface.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/vp8/vp8_cx_iface.c b/vp8/vp8_cx_iface.c index d65bf9652..b322e92e4 100644 --- a/vp8/vp8_cx_iface.c +++ b/vp8/vp8_cx_iface.c @@ -579,7 +579,7 @@ static vpx_codec_err_t set_screen_content_mode(vpx_codec_alg_priv_t *ctx, static vpx_codec_err_t vp8e_mr_alloc_mem(const vpx_codec_enc_cfg_t *cfg, void **mem_loc) { - vpx_codec_err_t res = 0; + vpx_codec_err_t res = VPX_CODEC_OK; #if CONFIG_MULTI_RES_ENCODING LOWER_RES_FRAME_INFO *shared_mem_loc; @@ -588,12 +588,13 @@ static vpx_codec_err_t vp8e_mr_alloc_mem(const vpx_codec_enc_cfg_t *cfg, shared_mem_loc = calloc(1, sizeof(LOWER_RES_FRAME_INFO)); if (!shared_mem_loc) { - res = VPX_CODEC_MEM_ERROR; + return VPX_CODEC_MEM_ERROR; } shared_mem_loc->mb_info = calloc(mb_rows * mb_cols, sizeof(LOWER_RES_MB_INFO)); if (!(shared_mem_loc->mb_info)) { + free(shared_mem_loc); res = VPX_CODEC_MEM_ERROR; } else { *mem_loc = (void *)shared_mem_loc; |