From nobody Mon Feb 9 00:20:16 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; 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 1536115142210521.2600525327329; Tue, 4 Sep 2018 19:39:02 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6B4E9307D84F; Wed, 5 Sep 2018 02:39:00 +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 AB6B116BFF; Wed, 5 Sep 2018 02:38:59 +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 5BF44181A369; Wed, 5 Sep 2018 02:38:59 +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 w852cqbT017964 for ; Tue, 4 Sep 2018 22:38:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 240221758E; Wed, 5 Sep 2018 02:38:52 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 193991758C for ; Wed, 5 Sep 2018 02:38:50 +0000 (UTC) Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) (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 2EC9C356C9 for ; Wed, 5 Sep 2018 02:38:49 +0000 (UTC) Received: by mail-qk1-f194.google.com with SMTP id b19-v6so3923602qkc.6 for ; Tue, 04 Sep 2018 19:38:49 -0700 (PDT) Received: from localhost.localdomain ([2804:431:b704:f07a:754f:6e69:b49d:d0f3]) by smtp.gmail.com with ESMTPSA id v13-v6sm298798qtg.82.2018.09.04.19.38.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 19:38:47 -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=p1Rm1qOuqvFFxdZ7e85k4cnF02blTSCa5mcxPGaSckA=; b=lU5/NRfHM42s+bKvb937gZlG8szDe+5N5y7Dwf5VtlgOwPckxYWWwZRV7cVm8E0nAK uJ7odTtXmKFCnzTvRVWrudlZZmAJIJbAZTnmyy3w1g8IxjnwPvzxf5NI84IaJTe1gY7q ElYA+AVUuGcPnYQ4EQYH+XgRJbHfYjppPgGkqoBsS3r1WJf+XtAJ/TIwsXn0i01ml11E sEh61y+rfw9cZUZsuEXX93sh/z1acSfxWvS6NRGM3sTb3EHE/dGRye4y9UVu4h+MvrIH bW+2V3Ny8igPnK1vuhN8RMvO0bRbA8Y2xXGX4vtWicWUGsT+km+BLFhgHtK1We6+1jk+ rMrg== 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=p1Rm1qOuqvFFxdZ7e85k4cnF02blTSCa5mcxPGaSckA=; b=OJccJ/2Fp5tlxGOL/DFmlVrB/FQ8O4BpEbAOOmZ9eb7qpuQJXzfcsYkA5F89cTO/6k NZFAtNLbv6jM6HenbAN9w07LJwLXLgZVQfdpIgUgM2Qg/F0lwvp5kAiO1nMYa8czwpdr i3JDQCP/pRcjSAKNF45tRNutkDNssFgmxKeAbbeznTHwFGYHyAYahN7he5qcNgd84KQ1 HJqYRaKQ4mzMVsDLaK+MX8HOQviNi7Jpo63ap37wO1cbAzabFsifZhd18EkirgWzdE5v +vLfywra3KJhIhiUn5CwdwwDt0KmTF9Wxd4xcIQqO8gkfj/OrxAZYIZZaMJ7lha3aIp7 nMkg== X-Gm-Message-State: APzg51BES4JM7IXVlLypmhqocusbYG+N5wZkWGKkVdWJ83gB2oiTrrg7 d/5I5lOxwTn1QY4x/o8NGUBES5HM X-Google-Smtp-Source: ANB0VdalBYniyIBL2jBNLXpXJomf7GvALzUxQT9CA17rr6u7BdeDJ0N0uasVo0GyINFIvHXbiT9czg== X-Received: by 2002:a37:2990:: with SMTP id p16-v6mr29635105qkp.331.1536115128218; Tue, 04 Sep 2018 19:38:48 -0700 (PDT) From: Julio Faracco To: libvir-list@redhat.com Date: Tue, 4 Sep 2018 23:38:33 -0300 Message-Id: <20180905023833.4867-5-jcfaracco@gmail.com> In-Reply-To: <20180905023833.4867-1-jcfaracco@gmail.com> References: <20180905023833.4867-1-jcfaracco@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 05 Sep 2018 02:38:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 05 Sep 2018 02:38:49 +0000 (UTC) for IP:'209.85.222.194' DOMAIN:'mail-qk1-f194.google.com' HELO:'mail-qk1-f194.google.com' FROM:'jcfaracco@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.111 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.222.194 mail-qk1-f194.google.com 209.85.222.194 mail-qk1-f194.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 05 Sep 2018 02:39:01 +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 --- 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..cf27f53437 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