summaryrefslogtreecommitdiffstats
path: root/kexec
diff options
context:
space:
mode:
authorPingfan Liu <piliu@redhat.com>2018-10-22 15:54:16 +0800
committerSimon Horman <horms@verge.net.au>2018-10-29 11:11:47 +0100
commit8db8b6613a00e736e450401cff6121ec550a72f5 (patch)
treee389280fbb2975be2b5a618eea540104eca9dd72 /kexec
parent94159bc3c264fa26395e56302072276a139d18af (diff)
downloadkexec-tools-8db8b6613a00e736e450401cff6121ec550a72f5.tar.gz
x86: fix BAD_FREE in get_efi_runtime_map()
If the err_out label is reached, address of a stack variable is passed to free(). Fix it. Signed-off-by: Pingfan Liu <piliu@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec')
-rw-r--r--kexec/arch/i386/x86-linux-setup.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
index 6c7d260b..6cda12c2 100644
--- a/kexec/arch/i386/x86-linux-setup.c
+++ b/kexec/arch/i386/x86-linux-setup.c
@@ -595,8 +595,8 @@ static int get_efi_runtime_map(struct efi_mem_descriptor **map)
closedir(dirp);
return nr_maps;
err_out:
- if (map)
- free(map);
+ if (*map)
+ free(*map);
closedir(dirp);
return 0;
}