From nobody Sat Feb 7 07:25:48 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 1537296543941866.4739660234612; Tue, 18 Sep 2018 11:49:03 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 51DC230014CB; Tue, 18 Sep 2018 18:49:01 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0A3C43091376; Tue, 18 Sep 2018 18:49:01 +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 AEC79181A13C; Tue, 18 Sep 2018 18:49:00 +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 w8IImZ0Z003553 for ; Tue, 18 Sep 2018 14:48:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id 06CE617581; Tue, 18 Sep 2018 18:48:35 +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 2CC2F7A431; Tue, 18 Sep 2018 18:48:33 +0000 (UTC) From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 18 Sep 2018 20:48:07 +0200 Message-Id: <20180918184818.17546-5-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 04/15] xen_xl: Adapt xenParseCmdline 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.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 18 Sep 2018 18:49:02 +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_xl.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c index 19b6604e05..e4ef061cdb 100644 --- a/src/xenconfig/xen_xl.c +++ b/src/xenconfig/xen_xl.c @@ -65,37 +65,44 @@ extern int xlu_disk_parse(XLU_Config *cfg, static int xenParseCmdline(virConfPtr conf, char **r_cmdline) { char *cmdline =3D NULL; - const char *root, *extra, *buf; + const char *root =3D NULL, *extra =3D NULL, *buf =3D NULL; + int ret =3D -1; =20 if (xenConfigGetString(conf, "cmdline", &buf, NULL) < 0) - return -1; + goto cleanup; =20 if (xenConfigGetString(conf, "root", &root, NULL) < 0) - return -1; + goto cleanup; =20 if (xenConfigGetString(conf, "extra", &extra, NULL) < 0) - return -1; + goto cleanup; =20 if (buf) { if (VIR_STRDUP(cmdline, buf) < 0) - return -1; + goto cleanup; if (root || extra) VIR_WARN("ignoring root=3D and extra=3D in favour of cmdline= =3D"); } else { if (root && extra) { if (virAsprintf(&cmdline, "root=3D%s %s", root, extra) < 0) - return -1; + goto cleanup; } else if (root) { if (virAsprintf(&cmdline, "root=3D%s", root) < 0) - return -1; + goto cleanup; } else if (extra) { if (VIR_STRDUP(cmdline, extra) < 0) - return -1; + goto cleanup; } } =20 *r_cmdline =3D cmdline; - return 0; + ret =3D 0; + + cleanup: + VIR_FREE(buf); + VIR_FREE(extra); + VIR_FREE(root); + return ret; } =20 static int --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list