elf2dmp: free memory in failure
PATCH RESEND 1/1 elf2dmp: free memory in failure
From: lu zhipeng <[email protected]>
The 'kdgb' is allocating memory in get_kdbg(), but it is not freed in error path. So fix that.
--- contrib/elf2dmp/main.c | 1 + 1 file changed, 1 insertion(+)
contrib/elf2dmp/main.c +1 -0
@@ -125,6 +125,7 @@ static KDDEBUGGER_DATA64 *get_kdbg(uint64_t KernBase, struct pdb_reader *pdb,if (va_space_rw (vs, KdDebuggerDataBlock, kdbg, kdbg_hdr.Size,0 )) {eprintf ("Failed to extract entire KDBG\n" ); +free (kdbg);return NULL ; }
Signature · 1 line
2.31.1
Quoted 16 lines · luzhipeng
From: lu zhipeng <[email protected]>
The 'kdgb' is allocating memory in
get_kdbg(), but it is not freed in error path. So fix that.Signed-off-by lu zhipeng <[email protected]>--- contrib/elf2dmp/main.c | 1 + 1 file changed, 1 insertion(+)contrib/elf2dmp/main.c +0
-0
contrib/elf2dmp/main.c static KDDEBUGGER_DATA64 *get_kdbg(uint64_t KernBase, struct pdb_reader *pdb, · line 131
Quoted 7 lines
contrib/elf2dmp/main.c +1
-0@@ -125,6 +125,7 @@ static KDDEBUGGER_DATA64 *get_kdbg(uint64_t KernBase, struct pdb_reader *pdb,if (va_space_rw (vs, KdDebuggerDataBlock, kdbg, kdbg_hdr.Size,0 )) {eprintf ("Failed to extract entire KDBG\n" ); +free (kdbg);return NULL ; }
I suppose Philippe's R-b should be on this version of the patch, not previous one. Also I'm not sure if this patch should go through Paolo's branch or QEMU Trivial.
Laurent Vivier
AppliedLe 07/10/2022 à 04:01, luzhipeng a écrit :
Quoted 15 lines
From: lu zhipeng <[email protected]>
The 'kdgb' is allocating memory in
get_kdbg(), but it is not freed in error path. So fix that.Signed-off-by lu zhipeng <[email protected]>--- contrib/elf2dmp/main.c | 1 + 1 file changed, 1 insertion(+)contrib/elf2dmp/main.c +0
-0
contrib/elf2dmp/main.c static KDDEBUGGER_DATA64 *get_kdbg(uint64_t KernBase, struct pdb_reader *pdb, · line 131
Quoted 7 lines
contrib/elf2dmp/main.c +1
-0@@ -125,6 +125,7 @@ static KDDEBUGGER_DATA64 *get_kdbg(uint64_t KernBase, struct pdb_reader *pdb,if (va_space_rw (vs, KdDebuggerDataBlock, kdbg, kdbg_hdr.Size,0 )) {eprintf ("Failed to extract entire KDBG\n" ); +free (kdbg);return NULL ; }
Applied to my trivial-patches branch.
Thanks,
Laurent