[PATCH] elf_info.c: fix memory leak in get_kcore_dump_loads()

Atsushi Kumagai ats-kumagai at wm.jp.nec.com
Tue Mar 21 23:59:29 PDT 2017


Hello Pingfan,

It would be helpful if you could mention that the patch is for
makedumpfile when you post that, otherwise I could overlook that.

Anyway, I'll merge this patch into v1.6.2 after adding semicolon
to the back of "free(pls)".

Thanks,
Atsushi Kumagai

>Signed-off-by: Pingfan Liu <piliu at redhat.com>
>---
> elf_info.c | 2 ++
> 1 file changed, 2 insertions(+)
>
>diff --git a/elf_info.c b/elf_info.c
>index d84553a..35e754b 100644
>--- a/elf_info.c
>+++ b/elf_info.c
>@@ -893,12 +893,14 @@ int get_kcore_dump_loads(void)
> 				|| !is_phys_addr(p->virt_start))
> 			continue;
> 		if (j >= loads)
>+			free(pls)
> 			return FALSE;
>
> 		if (j == 0) {
> 			offset_pt_load_memory = p->file_offset;
> 			if (offset_pt_load_memory == 0) {
> 				ERRMSG("Can't get the offset of page data.\n");
>+				free(pls)
> 				return FALSE;
> 			}
> 		}
>--
>2.7.4
>
>
>_______________________________________________
>kexec mailing list
>kexec at lists.infradead.org
>http://lists.infradead.org/mailman/listinfo/kexec




More information about the kexec mailing list