From nobody Thu May 2 07:29:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1629720628; cv=none; d=zohomail.com; s=zohoarc; b=E2dBnEORhEvIR9ORFQ8GGGdx7Qe6v5zkHyBoZI28c31tGEg2uCk75m2m0najWU1skJ38jEpbPMYuCPu2dJFgGlVejVu9Jmokg/BrwUvkZ6qZSZQHAlvDZ8TvgWe1OtiGlVntZJZi1kuzBnlNGqmwa9Y4NP3I9Mm5PjaFqYj9sh0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629720628; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=jmaz9l++oselaioJmjBksHtQiy+KxEjbqf/05i0dXgk=; b=SBYIPJI6fbqbGa2uBy+PRuKcEjh9VgMNwpFjdKWzDVsfMji1VJlOsOrHWdvhH+nlf4FHeJqXQOd7Ttyd8qcivviAJzdAR0cR8hG8bq0XV66cI0fc5XIJlgKtGTsvXcqU5CynTs0ycl7PYQuv+qwwYmY6vrvWR3VbyLzLoBCvoT8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1629720628765114.17099287112399; Mon, 23 Aug 2021 05:10:28 -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-526-ZMJEAjonOpacs2Fiai6AKA-1; Mon, 23 Aug 2021 08:10:26 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D5DC4DF8A0; Mon, 23 Aug 2021 12:10:20 +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 2C00260854; Mon, 23 Aug 2021 12:10:20 +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 74FD91821888; Mon, 23 Aug 2021 12:10:18 +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 17NCAG7X001423 for ; Mon, 23 Aug 2021 08:10:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id DEEDE2C175; Mon, 23 Aug 2021 12:10:16 +0000 (UTC) Received: from bart.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A2B260BD9 for ; Mon, 23 Aug 2021 12:10:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629720627; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=jmaz9l++oselaioJmjBksHtQiy+KxEjbqf/05i0dXgk=; b=jPMeIfyQ0sI9hF0rXPbRNI23Cdse+6d3WD1AXynimNpc+JWOm9j+cSJ9gbrip3s6UsP+aC O4gpX/jTe0K7slIp7G3sTEsR/Wn+R9yvi+h2YdbkdgH2+zFbO6HevSwNn1FNE455f2msGM R4wG/zGxfCo1mkyguJZ59hXpdzCTvGo= X-MC-Unique: ZMJEAjonOpacs2Fiai6AKA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] virsh-snapshot: Don't leak @then in cmdSnapshotList() Date: Mon, 23 Aug 2021 14:10:14 +0200 Message-Id: <8f4bcefe4a5570547e5092e4c08cfc66dd8a5539.1629720608.git.mprivozn@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.13 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) X-ZM-MESSAGEID: 1629720630865100001 Content-Type: text/plain; charset="utf-8" The variable is used inside a loop in which it' allocated in each iteration. Bring it inside the loop so that g_autoptr() kicks in each iteration. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- tools/virsh-snapshot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index ee99d0e061..e08ecb6910 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -1439,7 +1439,6 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd) size_t i; virDomainSnapshotPtr snapshot =3D NULL; long long creation_longlong; - g_autoptr(GDateTime) then =3D NULL; bool tree =3D vshCommandOptBool(cmd, "tree"); bool name =3D vshCommandOptBool(cmd, "name"); bool from =3D vshCommandOptBool(cmd, "from"); @@ -1533,6 +1532,7 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd) } =20 for (i =3D 0; i < snaplist->nsnaps; i++) { + g_autoptr(GDateTime) then =3D NULL; g_autofree gchar *thenstr =3D NULL; g_autoptr(xmlDoc) xml =3D NULL; g_autoptr(xmlXPathContext) ctxt =3D NULL; --=20 2.31.1