From nobody Tue Apr 23 11:09:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584962221; cv=none; d=zohomail.com; s=zohoarc; b=aEL5zPERz9Pl+YWQVjOYyrhEPlytlxXJMKE5oW97lI3NUlbNfE+5law9c+Nu7XcRa2bepZSs+TiwfN5xBoWFP23Y+onF4uaBFJSbFJ4b9R36evavFSLRJadwLuw1MNzPn09p1GdYH1zPvtTnSr63+cAY3ei51tLKtmnbprrzDEg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584962221; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To; bh=8e92/e/SiJXfJdWWFUwxxZzvctMvLNLc7qAWt6+Hgmg=; b=U6ykQ2DRG8UqKXbS2MMVDB1KhvxAwJraLNEWSevxcfULFBwBe0cztimqVknl2rJvNCzCtaO5TSCPy5jf7im+Un8Wa6cwDFn5xXXBc4/++hiYv5M6qejCHPReRq7w7+ITGFZprsVqyQ3sXJFZ2bbVu413AKgjIZq95tZhQLww9gQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1584962221319401.253543792007; Mon, 23 Mar 2020 04:17:01 -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-321-q0RDNG-tOLam1lB8z498rw-1; Mon, 23 Mar 2020 07:16:58 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5EE4E18FE861; Mon, 23 Mar 2020 11:16:52 +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 94A7C91290; Mon, 23 Mar 2020 11:16:51 +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 E761018089CE; Mon, 23 Mar 2020 11:16:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02NBEHhZ022482 for ; Mon, 23 Mar 2020 07:14:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 51CF41004020; Mon, 23 Mar 2020 11:14:17 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4DF9A100335C for ; Mon, 23 Mar 2020 11:14:14 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DA3268FF662 for ; Mon, 23 Mar 2020 11:14:14 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-424-Bnc0iJ8GMlmgv60R6Tt15w-1; Mon, 23 Mar 2020 07:14:12 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02NB3wnk091376 for ; Mon, 23 Mar 2020 07:14:11 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ywe7rsdmp-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 23 Mar 2020 07:14:10 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 23 Mar 2020 11:14:08 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 23 Mar 2020 11:14:06 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02NBE5s346792714 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Mar 2020 11:14:05 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 33BB252051; Mon, 23 Mar 2020 11:14:05 +0000 (GMT) Received: from oc2388111647.ibm.com (unknown [9.85.122.234]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id 643785204E; Mon, 23 Mar 2020 11:14:04 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584962220; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=8e92/e/SiJXfJdWWFUwxxZzvctMvLNLc7qAWt6+Hgmg=; b=UMLcGxXwzHlxNV2QnjSc5F6YZLhe7FUWng2QqaIWyxUmx2VKDfXaIhNxLTZGGPh47i+HqY mearrgwyP3HKAtFQMdC7761yoqA18qXjOmwi+OMN/YGmhK5ZLRlQP4SsCuBA6EgLY/aqBE IfDUVSfPkG+C90bvOSCrXbz+ObyVDtU= X-MC-Unique: q0RDNG-tOLam1lB8z498rw-1 X-MC-Unique: Bnc0iJ8GMlmgv60R6Tt15w-1 From: Seeteena Thoufeek To: libvir-list@redhat.com Subject: [PATCH v1] qemu: Use g_autofree and g_autoptr in qemuAgentSetUserPassword Date: Mon, 23 Mar 2020 16:43:59 +0530 X-TM-AS-GCONF: 00 x-cbid: 20032311-0012-0000-0000-000003962862 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20032311-0013-0000-0000-000021D31838 Message-Id: <1584962039-4286-1-git-send-email-s1seetee@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.645 definitions=2020-03-23_03:2020-03-21, 2020-03-23 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=612 impostorscore=0 bulkscore=0 phishscore=0 spamscore=0 adultscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=3 malwarescore=0 priorityscore=1501 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003230062 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 02NBEHhZ022482 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Mon, 23 Mar 2020 07:16:47 -0400 Cc: s1seetee@linux.vnet.ibm.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.11 X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Seeteena Thoufeek Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_agent.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index 9ea2c59563..1583a4eee2 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -2274,10 +2274,9 @@ qemuAgentSetUserPassword(qemuAgentPtr agent, const char *password, bool crypted) { - int ret =3D -1; - virJSONValuePtr cmd =3D NULL; - virJSONValuePtr reply =3D NULL; - char *password64 =3D NULL; + g_autoptr(virJSONValue) cmd =3D NULL; + g_autoptr(virJSONValue) reply =3D NULL; + g_autofree char *password64 =3D NULL; =20 password64 =3D g_base64_encode((unsigned char *)password, strlen(password)); @@ -2287,18 +2286,12 @@ qemuAgentSetUserPassword(qemuAgentPtr agent, "s:username", user, "s:password", password64, NULL))) - goto cleanup; + return -1; =20 if (qemuAgentCommand(agent, cmd, &reply, agent->timeout) < 0) - goto cleanup; - - ret =3D 0; + return -1; =20 - cleanup: - virJSONValueFree(cmd); - virJSONValueFree(reply); - VIR_FREE(password64); - return ret; + return 0; } =20 /* Returns: 0 on success --=20 2.18.2