From: Jerome Jiang Date: Thu, 6 Jun 2019 22:38:13 +0000 (-0700) Subject: vp8: fix leak in vp8e_mr_alloc_mem X-Git-Tag: v1.8.1~29 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=28cc5f3646bac9d01e583621f611303f738424f0;p=libvpx vp8: fix leak in vp8e_mr_alloc_mem BUG=webm:1596 Change-Id: I09ba00a7b7ad331671a7a285a2ac5630d8b62199 --- 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;