Message ID | 20171006235023.11952-50-f4bug@amsat.org |
---|---|
State | New |
Headers | show |
Series | use g_new() family of functions | expand |
Reviewed-by: Gabriel Somlo <gsomlo@gmail.com> On Fri, Oct 06, 2017 at 08:49:44PM -0300, Philippe Mathieu-Daudé wrote: > From: Marc-André Lureau <marcandre.lureau@redhat.com> > > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > [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 >
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));