diff options
author | Daniel Henrique Barboza | 2022-03-02 06:51:39 +0100 |
---|---|---|
committer | Cédric Le Goater | 2022-03-02 06:51:39 +0100 |
commit | bc940c46c987de51debf44efd9c219ea566c84ae (patch) | |
tree | d50c25446eba392f22e29d337d12db97f2d783b9 /hw/ppc | |
parent | hw/ppc/spapr_caps.c: use g_autofree in spapr_cap_set_string() (diff) | |
download | qemu-bc940c46c987de51debf44efd9c219ea566c84ae.tar.gz qemu-bc940c46c987de51debf44efd9c219ea566c84ae.tar.xz qemu-bc940c46c987de51debf44efd9c219ea566c84ae.zip |
hw/ppc/spapr_caps.c: use g_autofree in spapr_cap_get_string()
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220228175004.8862-5-danielhb413@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Diffstat (limited to 'hw/ppc')
-rw-r--r-- | hw/ppc/spapr_caps.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index aab313ffb1..2773f9db9e 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -95,12 +95,12 @@ static void spapr_cap_set_bool(Object *obj, Visitor *v, const char *name, } -static void spapr_cap_get_string(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static void spapr_cap_get_string(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { SpaprCapabilityInfo *cap = opaque; SpaprMachineState *spapr = SPAPR_MACHINE(obj); - char *val = NULL; + g_autofree char *val = NULL; uint8_t value = spapr_get_cap(spapr, cap->index); if (value >= cap->possible->num) { @@ -111,7 +111,6 @@ static void spapr_cap_get_string(Object *obj, Visitor *v, const char *name, val = g_strdup(cap->possible->vals[value]); visit_type_str(v, name, &val, errp); - g_free(val); } static void spapr_cap_set_string(Object *obj, Visitor *v, const char *name, |