From nobody Mon Feb 9 03:14:39 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=1612448053; cv=none; d=zohomail.com; s=zohoarc; b=ZxcRF3CcZPSDTlV52z2tAD0PTPmbjoRgehFiR/TCKDBz3RKH+xdhud7psEzYLcUvYiPgQ/sLUT6yCVUDd+zNj9nAnBTisHh494/Xe/pidUzUcYE9Fg2702N0ETSVxuMJuJiebh7uZgR/gRB+Gf7SXYg3wAYS9cNgs6V+W+gSVJ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612448053; 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=yrNSz8Vh2ADLSKZLV9UsooStVUxtWOIQhVU+osjhb6k=; b=CnnMSeEb1luCH0KWJxFIjeGxLeSdRZXH8zoj/GRvh7dOC/HOio51N9EaWyguuRJTm8nL3GoSSqFhQyuJE4vGynNFkHqqg3VZjDiXo9Q3QR8EyQXKojMRgw36L6VwLqrARsrsXQCxGobLxXjla3EgX1v/IuWpC+EhsHtOIBVo6DU= 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 1612448053063988.4148662500165; Thu, 4 Feb 2021 06:14:13 -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-39-jSk4KBs6P4G8X9u4U-32MA-1; Thu, 04 Feb 2021 09:14:02 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3C490835E2F; Thu, 4 Feb 2021 14:13:55 +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 745615D9EF; Thu, 4 Feb 2021 14:13:54 +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 D5CFA18095CB; Thu, 4 Feb 2021 14:13:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 114EDpxO031588 for ; Thu, 4 Feb 2021 09:13:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 162CA5D9EF; Thu, 4 Feb 2021 14:13:51 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C32F5D9C9 for ; Thu, 4 Feb 2021 14:13:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612448046; 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=yrNSz8Vh2ADLSKZLV9UsooStVUxtWOIQhVU+osjhb6k=; b=UUwN59v2VQj0w5m8XN5aQ4tH8rQgWK3YK+x7KCMVhPNytI5p1u5BfJEDFir1A3/WUJrkAL BtrIFi1ryo5pfY0Nuh824tkxkaXdbdUBI+CHbKV/pMOXngHjksyDNoRiI+JDXSPV1FWey8 boY+26lpoZuP2MDmguJDo+0MTDGVeVo= X-MC-Unique: jSk4KBs6P4G8X9u4U-32MA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 03/12] vsh: Use g_auto(GStrv) to free string list returned by completer callback Date: Thu, 4 Feb 2021 15:13:28 +0100 Message-Id: <1aeefc3b76c57c447569e6bfc304782e0b8d05e3.1612447905.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.14 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" This saves us explicit call of g_strfreev() in error path. Signed-off-by: Michal Privoznik --- tools/vsh.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index cc777bee12..3cb657f582 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -2778,9 +2778,9 @@ vshReadlineParse(const char *text, int state) list =3D vshReadlineOptionsGenerator(text, cmd, partial); =20 if (opt && opt->completer) { - char **completer_list =3D opt->completer(autoCompleteOpaqu= e, - partial, - opt->completer_flag= s); + g_auto(GStrv) completer_list =3D opt->completer(autoComple= teOpaque, + partial, + opt->complet= er_flags); =20 /* Escape completions, if needed (i.e. argument * we are completing wasn't started with a quote @@ -2805,7 +2805,6 @@ vshReadlineParse(const char *text, int state) if (completer_list && (vshCompleterFilter(&completer_list, text) < 0 || virStringListMerge(&list, &completer_list) < 0)) { - g_strfreev(completer_list); goto cleanup; } } --=20 2.26.2