qemu-trivial
[Top][All Lists]
Advanced

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

[Qemu-trivial] [PATCH 49/88] hw/misc: use g_new() family of functions


From: Philippe Mathieu-Daudé
Subject: [Qemu-trivial] [PATCH 49/88] hw/misc: use g_new() family of functions
Date: Fri, 6 Oct 2017 20:49:44 -0300

From: Marc-André Lureau <address@hidden>

Signed-off-by: Marc-André Lureau <address@hidden>
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
[PMD: added hw/misc/pvpanic.c]
---
 hw/misc/applesmc.c | 2 +-
 hw/misc/pvpanic.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/misc/applesmc.c b/hw/misc/applesmc.c
index 7be8b5f13c..12e32b107e 100644
--- a/hw/misc/applesmc.c
+++ b/hw/misc/applesmc.c
@@ -252,7 +252,7 @@ static void applesmc_add_key(AppleSMCState *s, const char 
*key,
 {
     struct AppleSMCData *def;
 
-    def = g_malloc0(sizeof(struct AppleSMCData));
+    def = g_new0(struct AppleSMCData, 1);
     def->key = key;
     def->len = len;
     def->data = data;
diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c
index 2b1e9a6450..dc51e4386c 100644
--- a/hw/misc/pvpanic.c
+++ b/hw/misc/pvpanic.c
@@ -95,7 +95,7 @@ static void pvpanic_isa_realizefn(DeviceState *dev, Error 
**errp)
         return;
     }
 
-    pvpanic_port = g_malloc(sizeof(*pvpanic_port));
+    pvpanic_port = g_new(uint16_t, 1);
     *pvpanic_port = cpu_to_le16(s->ioport);
     fw_cfg_add_file(fw_cfg, "etc/pvpanic-port", pvpanic_port,
                     sizeof(*pvpanic_port));
-- 
2.14.2




reply via email to

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