From 6ac9e15a2b634af7fbe52e29e165c8b0fd1c5be8 Mon Sep 17 00:00:00 2001 From: Yonghua Huang Date: Thu, 7 Mar 2019 23:22:09 +0800 Subject: [PATCH] dm: fix possible memory leak in 'load_elf32()' Dynamic memory stored in 'elf32_phdr' allocated through 'calloc' be lost. the patch port from apl_sdc_stable branch. Tracked-On: #2705 Signed-off-by: Yonghua Huang Signed-off-by: Tianhua Sun Acked-by: Yin Fengwei --- devicemodel/core/sw_load_elf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/devicemodel/core/sw_load_elf.c b/devicemodel/core/sw_load_elf.c index 3d0c933c0..a3b8778ad 100644 --- a/devicemodel/core/sw_load_elf.c +++ b/devicemodel/core/sw_load_elf.c @@ -136,6 +136,7 @@ static int load_elf32(struct vmctx *ctx, FILE *fp, void *buf) ctx->lowmem) { fprintf(stderr, "No enough memory to load elf file\n"); + free(elf32_phdr_bk); return -1; }