On Thu, Jun 29, 2017 at 20:03:56 +0200, Andrea Bolognani wrote:
Follow the same style as other similar functions.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/conf/domain_conf.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 15dd285..ccd3c27 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2380,25 +2380,26 @@ void virDomainVideoDefFree(virDomainVideoDefPtr def)
virDomainHostdevDefPtr
virDomainHostdevDefNew(virDomainXMLOptionPtr xmlopt)
{
- virDomainHostdevDefPtr def = NULL;
+ virDomainHostdevDefPtr def;
- if (VIR_ALLOC(def) < 0 ||
- VIR_ALLOC(def->info) < 0) {
- VIR_FREE(def);
+ if (VIR_ALLOC(def) < 0)
return NULL;
- }
+
+ if (VIR_ALLOC(def->info) < 0)
+ goto error;
if (xmlopt &&
xmlopt->privateData.hostdevNew &&
!(def->privateData = xmlopt->privateData.hostdevNew()))
goto error;
Changes below a rather pointless, and nothing gets added to the cleanup
section in other patches.
ACK to changes above this line.
+ cleanup:
return def;
error:
VIR_FREE(def->info);
VIR_FREE(def);
- return NULL;
+ goto cleanup;
}
--
2.7.5
--
libvir-list mailing list
libvir-list(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list