From nobody Sat Feb 7 07:31:26 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1537296552253714.8767927993346; Tue, 18 Sep 2018 11:49:12 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 23A9D88316; Tue, 18 Sep 2018 18:49:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E643D897F6; Tue, 18 Sep 2018 18:49:09 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 997E34A479; Tue, 18 Sep 2018 18:49:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8IImmIN003637 for ; Tue, 18 Sep 2018 14:48:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 939507A42E; Tue, 18 Sep 2018 18:48:48 +0000 (UTC) Received: from dahmer.redhat.com (ovpn-204-17.brq.redhat.com [10.40.204.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71B5917581; Tue, 18 Sep 2018 18:48:45 +0000 (UTC) From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 20:48:14 +0200 Message-Id: <20180918184818.17546-12-fidencio@redhat.com> In-Reply-To: <20180918184818.17546-1-fidencio@redhat.com> References: <20180918184818.17546-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [libvirt PATCH v6 11/15] xen_xm: Adapt xenParseXMOS due to changes in xenConfigGetString X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 18 Sep 2018 18:49:11 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 xenConfigGetString returns a newly-allocated pointer and it has to be freed by the caller. Signed-off-by: Fabiano Fid=C3=AAncio --- src/xenconfig/xen_xm.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/xenconfig/xen_xm.c b/src/xenconfig/xen_xm.c index 7b60f25ec1..a476401183 100644 --- a/src/xenconfig/xen_xm.c +++ b/src/xenconfig/xen_xm.c @@ -42,16 +42,16 @@ static int xenParseXMOS(virConfPtr conf, virDomainDefPtr def) { size_t i; + int ret =3D -1; + const char *boot =3D NULL, *extra =3D NULL, *root =3D NULL; =20 if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM) { - const char *boot; - if (VIR_ALLOC(def->os.loader) < 0 || xenConfigCopyString(conf, "kernel", &def->os.loader->path) < 0) - return -1; + goto cleanup; =20 if (xenConfigGetString(conf, "boot", &boot, "c") < 0) - return -1; + goto cleanup; =20 for (i =3D 0; i < VIR_DOMAIN_BOOT_LAST && boot[i]; i++) { switch (boot[i]) { @@ -72,38 +72,42 @@ xenParseXMOS(virConfPtr conf, virDomainDefPtr def) def->os.nBootDevs++; } } else { - const char *extra, *root; - if (xenConfigCopyStringOpt(conf, "bootloader", &def->os.bootloader= ) < 0) - return -1; + goto cleanup; if (xenConfigCopyStringOpt(conf, "bootargs", &def->os.bootloaderAr= gs) < 0) - return -1; + goto cleanup; =20 if (xenConfigCopyStringOpt(conf, "kernel", &def->os.kernel) < 0) - return -1; + goto cleanup; =20 if (xenConfigCopyStringOpt(conf, "ramdisk", &def->os.initrd) < 0) - return -1; + goto cleanup; =20 if (xenConfigGetString(conf, "extra", &extra, NULL) < 0) - return -1; + goto cleanup; =20 if (xenConfigGetString(conf, "root", &root, NULL) < 0) - return -1; + goto cleanup; =20 if (root && extra) { if (virAsprintf(&def->os.cmdline, "root=3D%s %s", root, extra)= < 0) - return -1; + goto cleanup; } else if (root) { if (virAsprintf(&def->os.cmdline, "root=3D%s", root) < 0) - return -1; + goto cleanup; } else if (extra) { if (VIR_STRDUP(def->os.cmdline, extra) < 0) - return -1; + goto cleanup; } } =20 - return 0; + ret =3D 0; + + cleanup: + VIR_FREE(extra); + VIR_FREE(root); + VIR_FREE(boot); + return ret; } =20 =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list