From nobody Tue Feb 10 05:43:49 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=1594006987; cv=none; d=zohomail.com; s=zohoarc; b=VK6JFEEE3tO9hHM1DdoZxPqj82ZBu0EBf2rsydEIRw0oFDRLpeROTVW1PqWPvciW34cSuSSlFa6Fw1G/V/L/GgoGrBl+38VBhFqq2wYkMvXXYZpXy6T6M27aJmKSzcd/3pnF9armCdRliCuH5Uq7ttuLEN3YmZqUlZVaouwTttU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594006987; 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=CuST70lRm+1QIXjMCpbzkvJEzhH83v2hWC7Ivmh/5Oc=; b=Wcs3btHAcCI61Rw0kRkUiiSJ4kgklCohBwIlv9uCWR/uhfSAA6dWUjhIW1+075yqEOJhwSl8er0arQCAjeiPVJ1Wm6cPJKp6VBcViJAQ4+7PnzqCHoWJzKP+ONIvD0F+ViUHMDdL9GogVAUF+av+icJJjwgs748Tu5VY/vEYYpk= 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 1594006987832497.6444180468503; Sun, 5 Jul 2020 20:43:07 -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-358-KEqTFFMoNr-LEDDdnoTi2w-1; Sun, 05 Jul 2020 23:42:14 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6B26C1007B16; Mon, 6 Jul 2020 03:42:09 +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 4AB2C28550; Mon, 6 Jul 2020 03:42:09 +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 18A06180043C; Mon, 6 Jul 2020 03:42:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0663fgr1004433 for ; Sun, 5 Jul 2020 23:41:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id C073571678; Mon, 6 Jul 2020 03:41:42 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-194.phx2.redhat.com [10.3.112.194]) by smtp.corp.redhat.com (Postfix) with ESMTP id 763DC275E25 for ; Mon, 6 Jul 2020 03:41:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594006986; 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=CuST70lRm+1QIXjMCpbzkvJEzhH83v2hWC7Ivmh/5Oc=; b=gr7w8j9U/yIHRQR90JoecA2+aRzVdCCqy4pPWf4KNLQm+w2bdFANfrDG2pgPMkwktq1T42 s7l+OfDs4NIwgpH1xMyO0xlLPyIGCOUATDoA4MbJUYw7nUYcNLHgZYZ7xu94svI0UyFdWF FdHel1ANWHTz1sskpanVhBKk4pTxLLw= X-MC-Unique: KEqTFFMoNr-LEDDdnoTi2w-1 From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH 05/32] lxc: use g_auto() for all virBuffers Date: Sun, 5 Jul 2020 23:41:00 -0400 Message-Id: <20200706034127.1117504-6-laine@redhat.com> In-Reply-To: <20200706034127.1117504-1-laine@redhat.com> References: <20200706034127.1117504-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.84 on 10.5.11.23 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: Laine Stump Reviewed-by: J=C3=A1n Tomko --- src/lxc/lxc_container.c | 4 +--- src/lxc/lxc_controller.c | 3 +-- src/lxc/lxc_driver.c | 2 +- src/lxc/lxc_fuse.c | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index c22b7b0709..24a3b6d626 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -174,7 +174,7 @@ static virCommandPtr lxcContainerBuildInitCmd(virDomain= DefPtr vmDef, { char uuidstr[VIR_UUID_STRING_BUFLEN]; virCommandPtr cmd; - virBuffer buf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; size_t i; =20 /* 'container_ptys' must exclude the PTY associated with @@ -185,7 +185,6 @@ static virCommandPtr lxcContainerBuildInitCmd(virDomain= DefPtr vmDef, virReportError(VIR_ERR_INTERNAL_ERROR, _("Expected a /dev path for '%s'"), ttyPaths[i]); - virBufferFreeAndReset(&buf); return NULL; } virBufferAdd(&buf, ttyPaths[i] + 5, -1); @@ -219,7 +218,6 @@ static virCommandPtr lxcContainerBuildInitCmd(virDomain= DefPtr vmDef, vmDef->os.initenv[i]->value); } =20 - virBufferFreeAndReset(&buf); return cmd; } =20 diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 89f9773b2c..01cdeb29db 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -1378,7 +1378,7 @@ virLXCControllerSetupUsernsMap(virDomainIdMapEntryPtr= map, int num, char *path) { - virBuffer map_value =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) map_value =3D VIR_BUFFER_INITIALIZER; size_t i; int ret =3D -1; =20 @@ -1402,7 +1402,6 @@ virLXCControllerSetupUsernsMap(virDomainIdMapEntryPtr= map, =20 ret =3D 0; cleanup: - virBufferFreeAndReset(&map_value); return ret; } =20 diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 46a182be45..1cdd6ee455 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -4618,7 +4618,7 @@ static char * lxcConnectGetSysinfo(virConnectPtr conn, unsigned int flags) { virLXCDriverPtr driver =3D conn->privateData; - virBuffer buf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; =20 virCheckFlags(0, NULL); =20 diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index 146629f67e..6e23361617 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -124,7 +124,7 @@ static int lxcProcReadMeminfo(char *hostpath, virDomain= DefPtr def, g_autofree char *line =3D NULL; size_t n; struct virLXCMeminfo meminfo; - virBuffer buffer =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) buffer =3D VIR_BUFFER_INITIALIZER; virBufferPtr new_meminfo =3D &buffer; =20 if (virLXCCgroupGetMeminfo(&meminfo) < 0) { @@ -223,7 +223,6 @@ static int lxcProcReadMeminfo(char *hostpath, virDomain= DefPtr def, memcpy(buf, virBufferCurrentContent(new_meminfo), res); =20 cleanup: - virBufferFreeAndReset(new_meminfo); VIR_FORCE_FCLOSE(fd); return res; } --=20 2.25.4