From ca44d65706d3c08a46ac0c7892c321978ef4c5b0 Mon Sep 17 00:00:00 2001 From: Nanxin Qin Date: Thu, 12 Jul 2018 14:03:21 +0800 Subject: [PATCH] fw: optimize the code that cause the mem leak. PD#168987 Change-Id: Ie71c41778ef909c0c676d93d3e87e2644d935cdf Signed-off-by: Nanxin Qin --- drivers/amlogic/media_modules/common/firmware/firmware_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/amlogic/media_modules/common/firmware/firmware_drv.c b/drivers/amlogic/media_modules/common/firmware/firmware_drv.c index 775f9352c728..1e054c59fecc 100644 --- a/drivers/amlogic/media_modules/common/firmware/firmware_drv.c +++ b/drivers/amlogic/media_modules/common/firmware/firmware_drv.c @@ -647,7 +647,7 @@ static int fw_data_binding(void) int ret = 0, magic = 0; struct fw_mgr_s *mgr = g_mgr; struct fw_files_s *files, *tmp; - char *buf = vmalloc(BUFF_SIZE); + char *buf = NULL; int size; if (list_empty(&mgr->files_head)) { @@ -655,6 +655,7 @@ static int fw_data_binding(void) return 0; } + buf = vmalloc(BUFF_SIZE); if (IS_ERR_OR_NULL(buf)) return -ENOMEM;