From: Daniel Henrique Barboza <danielhb413@gmail.com>
To: qemu-devel@nongnu.org
Cc: Daniel Henrique Barboza <danielhb413@gmail.com>,
qemu-ppc@nongnu.org, david@gibson.dropbear.id.au
Subject: [PATCH 1/3] ppc/spapr_nvdimm: use g_autofree in spapr_nvdimm_validate_opts()
Date: Tue, 25 Aug 2020 18:57:47 -0300 [thread overview]
Message-ID: <20200825215749.213536-2-danielhb413@gmail.com> (raw)
In-Reply-To: <20200825215749.213536-1-danielhb413@gmail.com>
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>
---
hw/ppc/spapr_nvdimm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/hw/ppc/spapr_nvdimm.c b/hw/ppc/spapr_nvdimm.c
index 81410aa63f..9a20a65640 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");
--
2.26.2
next prev parent reply other threads:[~2020-08-25 21:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-25 21:57 [PATCH 0/3] spapr NVDIMM: consider 'nvdimm' machine option Daniel Henrique Barboza
2020-08-25 21:57 ` Daniel Henrique Barboza [this message]
2020-08-25 21:57 ` [PATCH 2/3] spapr, spapr_nvdimm: fold NVDIMM validation in the same place Daniel Henrique Barboza
2020-08-25 21:57 ` [PATCH 3/3] ppc/spapr_nvdimm: do not enable support with 'nvdimm=off' Daniel Henrique Barboza
2020-08-28 13:17 ` [PATCH 0/3] spapr NVDIMM: consider 'nvdimm' machine option David Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200825215749.213536-2-danielhb413@gmail.com \
--to=danielhb413@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).