diff options
author | Suraj Shirvankar <surajshirvankar@gmail.com> | 2023-10-03 14:45:14 +0200 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2023-10-19 14:32:13 +0100 |
commit | 2a052b4ee01b3c413cef2ef49cb780cde17d4ba1 (patch) | |
tree | ca659b30aacebc24516ffc9dcc9f38f3130ae4c5 /contrib/elf2dmp/main.c | |
parent | 9ef2629712680e70cbf39d8b6cb1ec0e0e2e72fa (diff) |
contrib/elf2dmp: Use g_malloc(), g_new() and g_free()pull-target-arm-20231019
QEMU coding style uses the glib memory allocation APIs, not
the raw libc malloc/free. Switch the allocation and free
calls in elf2dmp to use these functions (dropping the now-unneeded
checks for failure).
Signed-off-by: Suraj Shirvankar <surajshirvankar@gmail.com>
Message-id: 169753938460.23804.11418813007617535750-1@git.sr.ht
[PMM: also remove NULL checks from g_malloc() calls;
beef up commit message]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'contrib/elf2dmp/main.c')
-rw-r--r-- | contrib/elf2dmp/main.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c index 6de5c9808e..cbc38a7c10 100644 --- a/contrib/elf2dmp/main.c +++ b/contrib/elf2dmp/main.c @@ -120,14 +120,11 @@ static KDDEBUGGER_DATA64 *get_kdbg(uint64_t KernBase, struct pdb_reader *pdb, } } - kdbg = malloc(kdbg_hdr.Size); - if (!kdbg) { - return NULL; - } + kdbg = g_malloc(kdbg_hdr.Size); if (va_space_rw(vs, KdDebuggerDataBlock, kdbg, kdbg_hdr.Size, 0)) { eprintf("Failed to extract entire KDBG\n"); - free(kdbg); + g_free(kdbg); return NULL; } @@ -643,7 +640,7 @@ int main(int argc, char *argv[]) } out_kdbg: - free(kdbg); + g_free(kdbg); out_pdb: pdb_exit(&pdb); out_pdb_file: |