Follow the same style as other similar functions. Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> --- 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; + cleanup: return def; error: VIR_FREE(def->info); VIR_FREE(def); - return NULL; + goto cleanup; } -- 2.7.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list