aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorDaniel Henrique Barboza <danielhb413@gmail.com>2020-08-25 18:57:47 -0300
committerDavid Gibson <david@gibson.dropbear.id.au>2020-09-08 10:08:42 +1000
commit90d282d0858cf5a38f3e8a7e201aeab2a0ccbe88 (patch)
tree425d2e9644843cfabd1efa5a7e0f47349d1791b8 /hw
parenteab0a2d06e97ebcf74e8437aa985eee5df3a4c68 (diff)
downloadqemu-90d282d0858cf5a38f3e8a7e201aeab2a0ccbe88.zip
qemu-90d282d0858cf5a38f3e8a7e201aeab2a0ccbe88.tar.gz
qemu-90d282d0858cf5a38f3e8a7e201aeab2a0ccbe88.tar.bz2
ppc/spapr_nvdimm: use g_autofree in spapr_nvdimm_validate_opts()
Since we're using the string just once, just use g_autofree and avoid leaking it without calling g_free(). Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Message-Id: <20200825215749.213536-2-danielhb413@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw')
-rw-r--r--hw/ppc/spapr_nvdimm.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/hw/ppc/spapr_nvdimm.c b/hw/ppc/spapr_nvdimm.c
index 81410aa..9a20a65 100644
--- a/hw/ppc/spapr_nvdimm.c
+++ b/hw/ppc/spapr_nvdimm.c
@@ -33,7 +33,7 @@
void spapr_nvdimm_validate_opts(NVDIMMDevice *nvdimm, uint64_t size,
Error **errp)
{
- char *uuidstr = NULL;
+ g_autofree char *uuidstr = NULL;
QemuUUID uuid;
int ret;
@@ -54,7 +54,6 @@ void spapr_nvdimm_validate_opts(NVDIMMDevice *nvdimm, uint64_t size,
&error_abort);
ret = qemu_uuid_parse(uuidstr, &uuid);
g_assert(!ret);
- g_free(uuidstr);
if (qemu_uuid_is_null(&uuid)) {
error_setg(errp, "NVDIMM device requires the uuid to be set");