From nobody Mon Feb 9 03:52:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584347803; cv=none; d=zohomail.com; s=zohoarc; b=PnZJalrbmqx+vdbM1YlId7a5KgjCaEo5wODj9bTQyga4pQPkSluAhgTiM2S+OvIAR/NYSEfAftdafZ3yScSZMi3Ub5pdHHcOiF3sI8OlrUwLGvH9mgnvRfEBzteekbYt7dG6O39WlZyy5aNb/qco3RkHD8dxciYYXTUphxKZ/1Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584347803; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=p9TegAKBVhtDWub0fVij1VCvghu7l9dyysEk/9Xes7w=; b=Bqz3e5eXcbZpU9HZxiP33xQF0On7gKGbOZDGsDm/JQBxhXRshvQQ6La3cEIwJ0e0ml2UnHwMvl6A1GARd8pfeylpQ9T6u3KcK89Nit6ICHzJPN0+7ZlpMTASFbQ72+wA7Nlavo7Joie8B0aygEjuOD9r0FLhcl6HjTp0BD7rJQM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1584347803013153.97456186240174; Mon, 16 Mar 2020 01:36:43 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-317-1dcSPe1DOk2fr1JPjfy4YQ-1; Mon, 16 Mar 2020 04:36:40 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8050B18B9FC2; Mon, 16 Mar 2020 08:36:34 +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 4C1E860C05; Mon, 16 Mar 2020 08:36:34 +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 EC09A1803C38; Mon, 16 Mar 2020 08:36:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02G8a0bS026184 for ; Mon, 16 Mar 2020 04:36:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id A86BA60BFB; Mon, 16 Mar 2020 08:36:00 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2CD5160BF3 for ; Mon, 16 Mar 2020 08:36:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584347802; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=p9TegAKBVhtDWub0fVij1VCvghu7l9dyysEk/9Xes7w=; b=gZIb2Fv4O0r5SEdQmW4OYwgf3S38NVj38TR+xiRoynzeiW1n/e3VGBoeSyVCogSUOfT8az /uOmBLcDZHqysooMTbKZK/Xu99W9fQxjMwDs60lLwN3umLtSgOWiqLHR21tEJ6S/1KGDXM 0KphNeZzgUWgN1BhY2aDfEHciEZB02I= X-MC-Unique: 1dcSPe1DOk2fr1JPjfy4YQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 03/12] qemuAgentCheckError: use g_autofree Date: Mon, 16 Mar 2020 09:35:45 +0100 Message-Id: <55036017c31c2ee53bb8b5cb808b6b266c21e2e6.1584347691.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_agent.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index 9ea2c59563..8790c47b87 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -1055,8 +1055,8 @@ qemuAgentCheckError(virJSONValuePtr cmd, { if (virJSONValueObjectHasKey(reply, "error")) { virJSONValuePtr error =3D virJSONValueObjectGet(reply, "error"); - char *cmdstr =3D virJSONValueToString(cmd, false); - char *replystr =3D virJSONValueToString(reply, false); + g_autofree char *cmdstr =3D virJSONValueToString(cmd, false); + g_autofree char *replystr =3D virJSONValueToString(reply, false); /* Log the full JSON formatted command & error */ VIR_DEBUG("unable to execute QEMU agent command %s: %s", @@ -1073,20 +1073,16 @@ qemuAgentCheckError(virJSONValuePtr cmd, qemuAgentCommandName(cmd), qemuAgentStringifyError(error)); - VIR_FREE(cmdstr); - VIR_FREE(replystr); return -1; } else if (!virJSONValueObjectHasKey(reply, "return")) { - char *cmdstr =3D virJSONValueToString(cmd, false); - char *replystr =3D virJSONValueToString(reply, false); + g_autofree char *cmdstr =3D virJSONValueToString(cmd, false); + g_autofree char *replystr =3D virJSONValueToString(reply, false); VIR_DEBUG("Neither 'return' nor 'error' is set in the JSON reply %= s: %s", NULLSTR(cmdstr), NULLSTR(replystr)); virReportError(VIR_ERR_INTERNAL_ERROR, _("unable to execute QEMU agent command '%s'"), qemuAgentCommandName(cmd)); - VIR_FREE(cmdstr); - VIR_FREE(replystr); return -1; } return 0; --=20 2.24.1