Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp451967lqo; Fri, 10 May 2024 05:14:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVnQS9guNE3BomKTcUwFmnV+WoChlcOtO9Ud055btISLWfKYfJb5n9+KM26Mtb2fw1f5YHC/DT2CvPtkiwbqKB8+0a9U1LiSDZ5nxOYqw== X-Google-Smtp-Source: AGHT+IGiyj+l8YY8J4fWv+t6Qdhu+bL+Y3vVnU/JJvjrScmUbvR4/p7vijWIYfUNTLWBH1mY+8eQ X-Received: by 2002:a05:6214:5684:b0:6a0:c767:3f65 with SMTP id 6a1803df08f44-6a1682588camr23445296d6.42.1715343289573; Fri, 10 May 2024 05:14:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715343289; cv=pass; d=google.com; s=arc-20160816; b=c8oC2+JaOBqVssAbonE/FZVcMvs9Nd+v5k2bkcnSayikv1eO5Sm5yPy8mmrU7BM0h8 5Dn6J4KoAhewO/RtV35mrW3P9lN2KGFpN2zUEybYIiLSW/Kw8IcVVvbbzWq7nmWHvyRo gdFvjgHUji5vL4/kcWpF30sQAr8w/t+SKKo9TK0Gfjlghpw440Bcn3B1XrfQNgF0V9Fn oa95il6/BX39PkvzmYDfKA4OMPYr4hgbzIOpeFFl1znxGl2Ia3chV0jWmVrF9v01yJPM wgL/lW/Womvw6HBHTchQ6Kua3tPrejijBdIS4H9FiGHd5DVsccfyavQ6JxKUbyeXDZnM XyrQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=hnhDI8/mO1GuGrS9cCr9P/Yv/v6mWumBq1OYgY0ZHQM=; fh=uo5u2TQK/HQlhydMwGLjBAnuDwaLxndJ/cgWTjIagS8=; b=CXbRVU5nEbHgBGbQz5yrit5xMpjCvawHMXdDTSaEqSxvdc1moNvgSBKrYsQwAy7n0y luuxkX5UFaQETSwpyuAjecuQzw6p1cSuQLTwAZCpMBvb9/RyZEfCVKNv5ZvdfCaZpJVk Un6DHjsIFWngVoGugMkGZgZNYEJaSS6SsZtTxig3lUpOp+WYY8emReKe0Y9YDOO4wEKw dGAsX3Rmd1674A+EEtBnUPZOpvpVcULxp47FU3DVSOD//ROggvtATDj6yXiOf6u69S3B PBh6O+WRPUDpKq3eO2OvIdMciD2GxGAYD5qgZDIcdu9L1nflsNH1H7P7pfpiVGSDRuA1 slXA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=hadess.net); spf=pass (google.com: domain of linux-bluetooth+bounces-4477-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4477-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f2b682bsi34359446d6.330.2024.05.10.05.14.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 05:14:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-4477-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=hadess.net); spf=pass (google.com: domain of linux-bluetooth+bounces-4477-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4477-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3A6281C211D6 for ; Fri, 10 May 2024 12:14:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C20B31708B1; Fri, 10 May 2024 12:14:17 +0000 (UTC) X-Original-To: linux-bluetooth@vger.kernel.org Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7AAFA16F829 for ; Fri, 10 May 2024 12:14:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.195 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715343257; cv=none; b=AugFvVFW5QhU8wKTBneX2en5uRX3lJT59W/OSnfyKxquDfMX1fQTfvFGcKwTR79kNRWVReP6gPVAbvtO8sXTyPqxXCuDJE6rRoP98U80NtVXhstdwUnQTDlx44rtltZkZ5kMArbFNsoH5N92bttj673bwWvT0RY0FzPjcMkVk2E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715343257; c=relaxed/simple; bh=XL/7SxkDVsEMuouDDcQaTT4AwMz/tx8Nfzhai1nup08=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bvQMiCWRWNgoqTEfue5yu/G9k+Im4WOXSHjlqLxgNuYoKRT0ZCJEKXft1mDN/tiigXACHkBb3l/BHaDbtVcoJCZHQRBEZ45q+eKs/egnKQcvZKQyNdVYUXW+kpR8Cp7FHQqfePKY3T1Lf/XSYYMvVAY0SenN2ck3JS3Broayfqo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hadess.net; spf=pass smtp.mailfrom=hadess.net; arc=none smtp.client-ip=217.70.183.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hadess.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hadess.net Received: by mail.gandi.net (Postfix) with ESMTPSA id 6CA1160011; Fri, 10 May 2024 12:13:58 +0000 (UTC) From: Bastien Nocera To: linux-bluetooth@vger.kernel.org Cc: Bastien Nocera Subject: [BlueZ v2 09/20] media: Fix memory leak Date: Fri, 10 May 2024 14:10:19 +0200 Message-ID: <20240510121355.3241456-10-hadess@hadess.net> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240510121355.3241456-1-hadess@hadess.net> References: <20240510121355.3241456-1-hadess@hadess.net> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: hadess@hadess.net Error: RESOURCE_LEAK (CWE-772): [#def47] [important] bluez-5.75/profiles/audio/media.c:1278:2: alloc_arg: "asprintf" allocates memory that is stored into "name". [Note: The source code implementation of the function has been overridden by a builtin model.] bluez-5.75/profiles/audio/media.c:1291:2: noescape: Resource "name" is not freed or pointed-to in "bt_bap_add_vendor_pac". bluez-5.75/profiles/audio/media.c:1297:3: leaked_storage: Variable "name" going out of scope leaks the storage it points to. 1295| error("Unable to create PAC"); 1296| free(metadata); 1297|-> return false; 1298| } 1299| --- profiles/audio/media.c | 1 + 1 file changed, 1 insertion(+) diff --git a/profiles/audio/media.c b/profiles/audio/media.c index 07147a25d532..4bbd584deaba 100644 --- a/profiles/audio/media.c +++ b/profiles/audio/media.c @@ -1293,6 +1293,7 @@ static bool endpoint_init_pac(struct media_endpoint *endpoint, uint8_t type, &data, metadata); if (!endpoint->pac) { error("Unable to create PAC"); + free(name); free(metadata); return false; } -- 2.44.0