From nobody Mon Feb 9 09:09:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1612183389; cv=none; d=zohomail.com; s=zohoarc; b=ffdnlGjcuKTOn4lEn8oxRefuYaVJWQ8WlmGM/+NaJCxEZhe2WKOzoPRtyvxG8uKPCoIcXLtGu65Y09HbyVtXd3u90ybK/HonDkMcL4ZKYq2r8oc6UPsPLVW7/SF2J9f2jem+Cx8JpqmgV7pt7NA1cWYHg2sR7H+1wYd6YhskWAw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612183389; h=Content-Type:Content-Transfer-Encoding:Cc: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=cgSsOJGP175ojW9+XJF2qzyf7hw9DvFFkh6vfTGSGps=; b=bSiMU8HZVeq2Q11b4s4HTa34i/Q+mSIeAKdPffrnNzr1++x7v8JBKe2L/2ry5Zflqi9NIG3QmKDfJfGQ5c5FvazLTetY1TY+II8yikraUcb4koz9CelM9qToaeUSFLjfRxPDzRW5hZomosJhIB8V514hw0uoXAgoO/8vBNhdP1s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1612183389399690.854356217208; Mon, 1 Feb 2021 04:43:09 -0800 (PST) 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-212-bGluX4BGOQG0CDcW074tPg-1; Mon, 01 Feb 2021 07:42:49 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 35E181084C80; Mon, 1 Feb 2021 12:42:39 +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 1490F5C3E5; Mon, 1 Feb 2021 12:42:39 +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 D218B1809CA6; Mon, 1 Feb 2021 12:42:38 +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 111CgOKj014758 for ; Mon, 1 Feb 2021 07:42:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id D36EA62461; Mon, 1 Feb 2021 12:42:24 +0000 (UTC) Received: from work.redhat.com (ovpn-113-167.ams2.redhat.com [10.36.113.167]) by smtp.corp.redhat.com (Postfix) with ESMTP id E50126267B; Mon, 1 Feb 2021 12:42:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612183388; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=cgSsOJGP175ojW9+XJF2qzyf7hw9DvFFkh6vfTGSGps=; b=U7aHPQ+0xYU941zyin0Z/fL9Fz4sE+K+qm1yb7KcjnHLaH+vlqTbpPFcwMmTwf3RqZPtdV /CYWkV0BX8hhNSgU1B0K3tnjBivJksirz1csxM61Dap4YJAZidefIzVm4lU+hyU1lxPuM/ x8M8KMn7+xy6F/jcLRaNG9D05BGyNDE= X-MC-Unique: bGluX4BGOQG0CDcW074tPg-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH v2 10/10] vircommand: Simplify virCommandAddArg Date: Mon, 1 Feb 2021 13:42:07 +0100 Message-Id: <20210201124207.148709-11-twiederh@redhat.com> In-Reply-To: <20210201124207.148709-1-twiederh@redhat.com> References: <20210201124207.148709-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Peter Krempa , Tim Wiederhake 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.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: Tim Wiederhake Reviewed-by: Peter Krempa --- src/util/vircommand.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index c3a98bbeac..b1a26f68aa 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -1520,8 +1520,6 @@ virCommandAddEnvXDG(virCommandPtr cmd, const char *ba= seDir) void virCommandAddArg(virCommandPtr cmd, const char *val) { - char *arg; - if (!cmd || cmd->has_error) return; =20 @@ -1530,16 +1528,13 @@ virCommandAddArg(virCommandPtr cmd, const char *val) return; } =20 - arg =3D g_strdup(val); - /* Arg plus trailing NULL. */ if (VIR_RESIZE_N(cmd->args, cmd->maxargs, cmd->nargs, 1 + 1) < 0) { - VIR_FREE(arg); cmd->has_error =3D ENOMEM; return; } =20 - cmd->args[cmd->nargs++] =3D arg; + cmd->args[cmd->nargs++] =3D g_strdup(val); } =20 =20 --=20 2.26.2