From nobody Thu Sep 19 01:00:22 2024 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 153612128056477.1678901605153; Tue, 4 Sep 2018 21:21:20 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 780F081F09; Wed, 5 Sep 2018 04:21:18 +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 197835C72F; Wed, 5 Sep 2018 04:21:18 +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 02B754A460; Wed, 5 Sep 2018 04:21:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w854LEO8028631 for ; Wed, 5 Sep 2018 00:21:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 83287308BDAD; Wed, 5 Sep 2018 04:21:14 +0000 (UTC) Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 77E06308BDAB for ; Wed, 5 Sep 2018 04:21:14 +0000 (UTC) Received: from mail-qt0-f196.google.com (mail-qt0-f196.google.com [209.85.216.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 72007308A94D for ; Wed, 5 Sep 2018 04:21:13 +0000 (UTC) Received: by mail-qt0-f196.google.com with SMTP id n6-v6so6646050qtl.4 for ; Tue, 04 Sep 2018 21:21:13 -0700 (PDT) Received: from localhost.localdomain ([2804:431:b704:f07a:754f:6e69:b49d:d0f3]) by smtp.gmail.com with ESMTPSA id a66-v6sm362192qkf.96.2018.09.04.21.21.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 21:21:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=44dLtGr/66/ENzvT1KbaYSz5JMIELF93R94f3yWInSM=; b=NEXAE0r+nc0h22naYP/0VNs6qP0KKDYmmZvvBgxTHRr75o2fkjpUcdR0JmNxuS2Sv0 ma4IG4atlLmExKCYN2B79366Yq2N9xZlINQ0Z4GsgEYAzuoUJHjmE3cXsziadLaHSonj HkLwNy9asfcO3gJEOqaraYGa0Yh0/k1zdaY/HolZm3TIYSg9DSFAOi2b1ShVduxishjW nzQOd34PnHk45zVZOdrqBUKzLvqlzXflyDLQBENAjLaLyIdcn8+jnGiqbao/S+qOBd54 MagBHFSX6I02x0fwzu4UZJpc149M99TvnzlEsu2s10pEQXYZgJLYh5FYdRzqVYkSoFiD Iyiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=44dLtGr/66/ENzvT1KbaYSz5JMIELF93R94f3yWInSM=; b=JDh8gJF9kHWkFtaP0q8FjkP0GWs/QhGULajD5z/ic8QOv9wCUX+hpiu2d/L8okaBjM bLXV2pfMii8T5y6TnOfzA0THFQBX/2PKs7Oy6hlDxmPiX9tFH793W5lA/3u/ulgYmwQF rEOdWF1/6r01Y9wDMpu6SWur+EJvluFZKF8CwTzKu2hkCpz5PS8OglqsRaoufbQttrJt muiwxTRy3T2uARnxQnGDAlLhhNL3lvpCb/wgD2IUNIhgOUpTSENhow3pop9sQQqVdDq0 u5a3pI/Bhm4rqarmI4VBVT0SoXO8HZqNn0lJzIPKjfP6B9q6lhaewMXdNuVoWOwdLSQg OuNw== X-Gm-Message-State: APzg51C/4VZrFfdiABUrwLUFKLXE+DpIOKCRvRX9QIAR7ABQmmyR3ksg V/wDJXh31h+jwYQTuVN+hne3NUvp X-Google-Smtp-Source: ANB0VdY3npFKKCWkaIJvo77UMDixDfoh7pOmrvGs3+/G+rD5/3jrWGI6nuTNdVzEOBkLqeccFJxCaA== X-Received: by 2002:ac8:70c5:: with SMTP id g5-v6mr32082580qtp.271.1536121272441; Tue, 04 Sep 2018 21:21:12 -0700 (PDT) From: Julio Faracco To: libvir-list@redhat.com Date: Wed, 5 Sep 2018 01:20:56 -0300 Message-Id: <20180905042056.21029-5-jcfaracco@gmail.com> In-Reply-To: <20180905042056.21029-1-jcfaracco@gmail.com> References: <20180905042056.21029-1-jcfaracco@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 05 Sep 2018 04:21:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 05 Sep 2018 04:21:13 +0000 (UTC) for IP:'209.85.216.196' DOMAIN:'mail-qt0-f196.google.com' HELO:'mail-qt0-f196.google.com' FROM:'jcfaracco@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.108 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.216.196 mail-qt0-f196.google.com 209.85.216.196 mail-qt0-f196.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.41 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 4/4] qemu: unlink the error report from VIR_STRDUP. 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 05 Sep 2018 04:21:19 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The function to retrieve the file system info using QEMU-GA is using some conditionals to retrieve the info. This is wrong because the error of some conditionals will be raised if VIR_STRDUP return errors and not if some problem occurred with JSON. Signed-off-by: Julio Faracco Reviewed-by: John Ferlan Reviewed-by: J=EF=BF=BDn Tomko --- src/qemu/qemu_agent.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index ac728becef..36dc18d72f 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -1836,6 +1836,7 @@ qemuAgentGetFSInfo(qemuAgentPtr mon, virDomainFSInfoP= tr **info, virJSONValuePtr data; virDomainFSInfoPtr *info_ret =3D NULL; virPCIDeviceAddress pci_address; + const char *result =3D NULL; =20 cmd =3D qemuAgentMakeCommand("guest-get-fsinfo", NULL); if (!cmd) @@ -1881,28 +1882,34 @@ qemuAgentGetFSInfo(qemuAgentPtr mon, virDomainFSInf= oPtr **info, if (VIR_ALLOC(info_ret[i]) < 0) goto cleanup; =20 - if (VIR_STRDUP(info_ret[i]->mountpoint, - virJSONValueObjectGetString(entry, "mountpoint")) <= 0) { + if (!(result =3D virJSONValueObjectGetString(entry, "mountpoint"))= ) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("'mountpoint' missing in reply of " "guest-get-fsinfo")); goto cleanup; } =20 - if (VIR_STRDUP(info_ret[i]->name, - virJSONValueObjectGetString(entry, "name")) < 0) { + if (VIR_STRDUP(info_ret[i]->mountpoint, result) < 0) + goto cleanup; + + if (!(result =3D virJSONValueObjectGetString(entry, "name"))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("'name' missing in reply of guest-get-fsinfo"= )); goto cleanup; } =20 - if (VIR_STRDUP(info_ret[i]->fstype, - virJSONValueObjectGetString(entry, "type")) < 0) { + if (VIR_STRDUP(info_ret[i]->name, result) < 0) + goto cleanup; + + if (!(result =3D virJSONValueObjectGetString(entry, "type"))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("'type' missing in reply of guest-get-fsinfo"= )); goto cleanup; } =20 + if (VIR_STRDUP(info_ret[i]->fstype, result) < 0) + goto cleanup; + if (!(entry =3D virJSONValueObjectGet(entry, "disk"))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("'disk' missing in reply of guest-get-fsinfo"= )); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list