Skip to contentSkip to conversation

elf_info.c: fix memory leak in get_kcore_dump_loads()

PATCH In review Pingfan Liu 2 participants 3 messages Mar 21, 2017 – Mar 22, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 elf_info.c: fix memory leak in get_kcore_dump_loads()

---
 elf_info.c | 2 ++
 1 file changed, 2 insertions(+)
elf_info.c +2 -0
index d84553a..35e754b 100644
@@ -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;
 			}
 		}
Signature · 7 lines
2.7.4


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#1 lore raw

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

Quoted 28 lines

---
elf_info.c | 2 ++

1 file changed, 2 insertions(+)
elf_info.c +2 -1
index d84553a..35e754b 100644
@@ -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

Quoted 4 lines

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#2 lore raw

----- Original Message -----

Quoted 11 lines

From: "Atsushi Kumagai" <[email protected]>
To: "Pingfan Liu" <[email protected]>
Cc: [email protected]
Sent: Wednesday, March 22, 2017 2:59:29 PM
Subject: RE: [PATCH] elf_info.c: fix memory leak in get_kcore_dump_loads()

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.

Sorry, and I will add such info.

Regards,
Pingfan

Quoted 34 lines

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

Thanks,
Atsushi Kumagai

Quoted 28 lines

---
elf_info.c | 2 ++

1 file changed, 2 insertions(+)
elf_info.c +2 -1
index d84553a..35e754b 100644
@@ -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

Quoted 11 lines
Quoted 4 lines

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec