Skip to contentSkip to conversation

elf2dmp: free memory in failure

PATCH Superseded luzhipeng 2 participants 2 messages Sep 29, 2022 – Oct 18, 2022

lore
Share & tools
lore

luzhipeng

author
#0 lore raw

PATCH 1/1 elf2dmp: free memory in failure

From: lu zhipeng <[email protected]>

---
 contrib/elf2dmp/main.c | 1 +
 1 file changed, 1 insertion(+)
contrib/elf2dmp/main.c +1 -0
index b9fc6d230c..d77b8f98f7 100644
@@ -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
Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines · luzhipeng

From: lu zhipeng <[email protected]>

---
  contrib/elf2dmp/main.c | 1 +
  1 file changed, 1 insertion(+)
contrib/elf2dmp/main.c +0 -0
index b9fc6d230c..d77b8f98f7 100644

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