dm: fix possible memory leak in 'load_elf32()'

Dynamic memory stored in 'elf32_phdr' allocated
through 'calloc' be lost.

Tracked-On: #2705
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
This commit is contained in:
Yonghua Huang 2019-03-07 23:22:09 +08:00 committed by wenlingz
parent 8cd892a4f0
commit 80d3584b07

View File

@ -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;
}