qemu-riscv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 11/19] smbios: clear smbios_tables pointer after freeing


From: Igor Mammedov
Subject: [PATCH 11/19] smbios: clear smbios_tables pointer after freeing
Date: Tue, 27 Feb 2024 16:47:41 +0100

that will avoid double free if smbios_get_tables() is called
multiple times.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/smbios/smbios.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 7c28b5f748..d9ba2072b1 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -1052,6 +1052,8 @@ void smbios_get_tables(MachineState *ms,
     return;
 err_exit:
     g_free(smbios_tables);
+    smbios_tables = NULL;
+    return;
 }
 
 static void save_opt(const char **dest, QemuOpts *opts, const char *name)
-- 
2.39.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]