From nobody Tue Jan 21 07:29:02 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=canonical.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1736263611999814.7252576505207; Tue, 7 Jan 2025 07:26:51 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 1BFA9E77; Tue, 7 Jan 2025 10:26:51 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 520D4110A; Tue, 7 Jan 2025 10:24:26 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id A51DCC7C; Tue, 7 Jan 2025 10:24:23 -0500 (EST) Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id CC587C7C for ; Tue, 7 Jan 2025 10:24:19 -0500 (EST) Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 0981B3F870 for ; Tue, 7 Jan 2025 15:24:19 +0000 (UTC) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2166e907b5eso208131435ad.3 for ; Tue, 07 Jan 2025 07:24:18 -0800 (PST) Received: from georgia.. ([2001:1284:f502:1965:7bc6:bb4:7636:7bb1]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-842b85f00f9sm31048120a12.43.2025.01.07.07.24.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 07:24:16 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1736263459; bh=fS3ikCwqEEwFmExhPX06DJ+FISp/hnNuN8QV0pbpyT8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aBl2TeEVM5026P14H+X+802fs/SY/3WGoF3zDFG5RZ6bz0uq/8RFrqwUBzDTTRBPk 5Bw5pWU4wKLN7sVQQZ0R+jr0vqaDD/HxjbDFOF7vX7uysYZnOFHbTk+zonBqm2kXi2 KbIYWA1d++OaWG1Y7yduEXORWMP237g2B+HqeYQDT8Nw2mWEOasAluBf5rMkvjfOCv zVn5iXqpQ6786bkzxKzUaKIfbPYP/c+raBSItIpAi82yLxO/9Fon4sxcI22wXHzOSt zmKtr0WAfwnOJ6yaJbPZco/TY3ANNK9wo9/jIFIXA+qZy0Tm7qj0Pa+r60OUlghIbr 94i3fGkVGSPiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736263457; x=1736868257; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fS3ikCwqEEwFmExhPX06DJ+FISp/hnNuN8QV0pbpyT8=; b=JjgKuOJ6mU62/dSu1UmcCUsn7DT9jCi6RkQABZK3H+RTX52INdirQaDe5vX7Q1Ybo8 kfbJxwrzQ8lIafjSr2oLX+mwzp06CZQAvAf9KdaoCMxKvGYeBvuLNBlW+yoK3nPvN/+t MO+FWVvYTXPh8VNicdcyHrqATMjHFFPUNogUyLppA4ZrtMUNjZ+UVSUKUs4O65JrWDBu h11JVKXSXAOWp2hEXoQNXpdl8Q1PI+MHU3oGKGIVvg4lc+DLppPPNUqoTkaoIMaqtXuf /xKXKh04OfxQp3erbtY+nD9OGCPThYKKlMAqiv/0vPHdZ+nL2pJoHq+NP7oEH/4mJjVp 4ATQ== X-Gm-Message-State: AOJu0Yw3AWSgi1KSA7Y1MGewqBHfxdwKkiRixHaltZjaMrmnQAo2UV61 dgQOboA2sLQSCJ6d1uz+m3TQ82DRKgFFOtoq4WmeX1xjo680tW5L1F3DyWTI0G7DnTGjVwsPktP SZyh6OPiUcC6NAptCHUsL+huVcUaAHVCgzQO07icJQUjCWjcL34lZ3VgohJmMAMBJbhY8KILPvO w4laM= X-Gm-Gg: ASbGncv2ES/xBz9fW88MFpZ8HVjqCkN8Ja29ZdCj9S+dU6Hr5wdwA0DRHHC4c/j0SS2 YxakhmcxpEp50LkORnzgkGR4DPSapwT0oxs23ib6uldQPgV0p9yO8jbql8PmPiqCUAaEFbYPGQA daCKS6t2SfbIcRwlT5cQFutAYZx5lD8Kcon2TwqqaH8WGiiQuRGjfhWPY/WJccJ7ca5Kvk2sM/f F+RxBLRcw4MWJoa+mdPYRuHo+ZwNv295HxDu3yfsmovvuCkT5JIEcj74tBdysc4jfWw X-Received: by 2002:a05:6a21:3285:b0:1e1:aad7:d50d with SMTP id adf61e73a8af0-1e5e084b681mr111520648637.46.1736263457240; Tue, 07 Jan 2025 07:24:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGB2YkQAFDvy0TIjtOiqt4m+bOSl5S3wm1NsLNrKOyzCCNsQq2LlL3/IcpLVTCZkD0XCzfFfg== X-Received: by 2002:a05:6a21:3285:b0:1e1:aad7:d50d with SMTP id adf61e73a8af0-1e5e084b681mr111520620637.46.1736263456932; Tue, 07 Jan 2025 07:24:16 -0800 (PST) From: Georgia Garcia To: devel@lists.libvirt.org Subject: [PATCH v3 1/4] security_apparmor: fix memleaks in AppArmorSetFDLabel Date: Tue, 7 Jan 2025 12:23:36 -0300 Message-ID: <20250107152357.1026544-2-georgia.garcia@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107152357.1026544-1-georgia.garcia@canonical.com> References: <20250107152357.1026544-1-georgia.garcia@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: X5XZ5XUSDZIFB76V5Z6EF7G2F4WHXGVM X-Message-ID-Hash: X5XZ5XUSDZIFB76V5Z6EF7G2F4WHXGVM X-MailFrom: georgia.garcia@canonical.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Georgia Garcia X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1736263613857116600 Content-Type: text/plain; charset="utf-8" proc and fd_path are allocated but never freed. Fix by using g_autofree instead. Fixes: b9757fea30785a92aa95ea675b9bc371e4fb2e8c Signed-off-by: Georgia Garcia Reviewed-by: Jim Fehlig --- src/security/security_apparmor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/security/security_apparmor.c b/src/security/security_appar= mor.c index eed0f265d6..ae2175d334 100644 --- a/src/security/security_apparmor.c +++ b/src/security/security_apparmor.c @@ -1109,8 +1109,8 @@ AppArmorSetFDLabel(virSecurityManager *mgr, virDomainDef *def, int fd) { - char *proc =3D NULL; - char *fd_path =3D NULL; + g_autofree char *proc =3D NULL; + g_autofree char *fd_path =3D NULL; =20 virSecurityLabelDef *secdef =3D virDomainDefGetSecurityLabelDef(def, SECURITY_APPARMOR_NAME); --=20 2.43.0