From nobody Tue Feb 10 16:18:36 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; 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 205.139.110.61 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=1594006947; cv=none; d=zohomail.com; s=zohoarc; b=AJ9DVkFrynbzJVNdRk/5BZpIdUOnb0N5loMdkKcliAVtLUfoAfXMtbeiBUr+536tI8no999Py4CXj4w5C2URiZff5eKxareWqAUSZgAD1A8zucKrnZrL4MqgrZnZBEJvWiQ5fiHxjcixicDbU9FZOso/2F2O+ttqGLN7pcTOVHE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594006947; 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=UQ0qmljKTUnkW9ZrA9hSaVwTvcZq2Eh8EIBkCDwnDYk=; b=QJDf7MPoJYJmgZwmaPj/2sa4VFrwEoPfKqboHf6wgxcYp0YIE95juI3yjA0vWi9EdototRyTh967lK8R8L17OseMH8K2GlIY4UeNz8kj+Gr5ZSVFrjT0xIk13pu1RriYscb/CyP+BgX4qLJ67GrY94uKs/1j7hi8ZdeKERi8jSQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 159400694730468.94640327655009; Sun, 5 Jul 2020 20:42:27 -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-40-jFD3IF2UN2KdsXr8srS6Zw-1; Sun, 05 Jul 2020 23:42:19 -0400 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 DC4608015F7; Mon, 6 Jul 2020 03:42:13 +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 BE5D75D9CC; Mon, 6 Jul 2020 03:42:13 +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 917E81806B0D; Mon, 6 Jul 2020 03:42:13 +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 0663fqOV004610 for ; Sun, 5 Jul 2020 23:41:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id B5BE6275E2E; Mon, 6 Jul 2020 03:41:52 +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 6BDA3129F95 for ; Mon, 6 Jul 2020 03:41:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594006946; 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=UQ0qmljKTUnkW9ZrA9hSaVwTvcZq2Eh8EIBkCDwnDYk=; b=NfbE5X7nfru1OZ6xDzQUG1xgvtbWjitKKoTcQB9xk7pzt/dB+CC7eLFZp9X76z81Cf/TQR riSCLo7kEIEcjvUpZQhiCUIObd4yKgUGY/80Ww8efJXqH9K60qg2eM7HUTicWb/GMEyUlt TFECIaDMnGaYJ7y687pJQA0r0ab80mk= X-MC-Unique: jFD3IF2UN2KdsXr8srS6Zw-1 From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH 19/32] libxml: eliminate extra copy of string Date: Sun, 5 Jul 2020 23:41:14 -0400 Message-Id: <20200706034127.1117504-20-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.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" libxlMakeNic was calling g_strdup(virBufferCurrentContent(&buf)) to make a copy of the buffer contents, and then later freeing the buffer without ever using it again. Instead of this extra strdup, just transfer ownership of the virBuffer's string with virBufferContentAndReset(), and be done with it. Signed-off-by: Laine Stump Reviewed-by: J=C3=A1n Tomko --- src/libxl/libxl_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 124e08d598..fe8ad4a3cb 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -1335,7 +1335,7 @@ libxlMakeNic(virDomainDefPtr def, } } } - x_nic->bridge =3D g_strdup(virBufferCurrentContent(&buf)); + x_nic->bridge =3D virBufferContentAndReset(&buf); G_GNUC_FALLTHROUGH; case VIR_DOMAIN_NET_TYPE_ETHERNET: x_nic->script =3D g_strdup(script); --=20 2.25.4