Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp370633lqo; Fri, 10 May 2024 02:24:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXZtE29F9n+zYKGLyWXlNN5SJEPAxm3mrO5kzS+2RPjeOC0C5tA8/jxymqk9QNnvpTmY9vgbeT3kOFuJioKGu9+za42SJxVwy3cIOfD+w== X-Google-Smtp-Source: AGHT+IHCzjBM2AasWWpgqEG2CFeCZLOZRHcarw2ENKdfNo5i7QtZiXDbbQFshO7n1N0aRW6eDG/i X-Received: by 2002:a05:6358:57a2:b0:18d:8fd9:aae with SMTP id e5c5f4694b2df-193bb63f031mr209053555d.15.1715333071117; Fri, 10 May 2024 02:24:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715333071; cv=pass; d=google.com; s=arc-20160816; b=zXAn00ch9pRvPuBrT9cYV8PEkF3+PRcKd6Lurrwj6lpeVYj+YBCFS18kcnTp+nHYdt o8Z3ucJGi6OoxdaxklGilkQBXjeMvQz52+cfB6dF1Q8MSIY0KjTX6ktylC4KuMXbeCQr u7qhVL4IYFhgBPSCQwOjnxXAS+pRfxOeXikI6s9yQyfKyURplW6jOY+e6qZXL444mz3f hRmEyb+NCHtjj/FIrw4oY/eYzLoae6966PDashlTrQ5Ye8kljHz6CqeBVWflx4K8dNuo vxA01Fc7FuuRSu2vTfGBkOFzOriI00kjRFfHtAHqHZzu85+MjZcsxClnWbqeG799OAD1 n+1Q== 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:to:from; bh=hnhDI8/mO1GuGrS9cCr9P/Yv/v6mWumBq1OYgY0ZHQM=; fh=4lGQI6056MBa4/oovMyIYaKLn+Wz/24RGvUivMmQP8E=; b=kSz5RVABUXe7VkgILtHjuNqlffpzM7tl3iO33zjKkZQDI2uATz94iWLn+028ARo18W jXMKL8pdyI0z3QKAe4BL9GM0xpnskRlRjHCd11PWEAs4HofM4quesOaqSc0BcCfChv34 0k5hSxYSMNHBLZVW5N7BjlJY52utXXKFDBkYGngKPQebS5XOSqLp3Cdc237DvYglbkp5 VpqYNl4zT6yxfusr942c2axKo0LmtWJArS4N2YgQW2yvcZ1agL9wK55Ab+FY1KNCUlgJ Dxf7zdY7De/nMdSd2cAdyL14eag2//w6Ndx16Twj03ILsf++dhegBw+uX2WkKU5o7Peh k9kA==; 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-4455-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4455-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-63412a4deb4si3159589a12.750.2024.05.10.02.24.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 02:24:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-4455-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=hadess.net); spf=pass (google.com: domain of linux-bluetooth+bounces-4455-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4455-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 72F55286603 for ; Fri, 10 May 2024 09:18:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ADC50168AF9; Fri, 10 May 2024 09:18:27 +0000 (UTC) X-Original-To: linux-bluetooth@vger.kernel.org Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (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 6D6401635C9 for ; Fri, 10 May 2024 09:18:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715332707; cv=none; b=cUWmF8UUZ4qtuLJDoC4/bfcACmb1MseQNH9Lw/OIec6k0ThK5GnHzySXCdR4pH5DDyahFSYYj1WIDT5IaWxjELIdp1xiTMPst5z7eUNbonaQHVIijlvblFal9kvQus+cfULp7tKM6rjQHLDVObzVOk0tqkyeJJadgM137BaxRto= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715332707; c=relaxed/simple; bh=XL/7SxkDVsEMuouDDcQaTT4AwMz/tx8Nfzhai1nup08=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZbbIVtntTw8wmCvxKyvFQSYAAWg4gyjff5M/lia/zQAVRwIkUVwtABQXMR826hPkJMbEpC7NzrJLqz0LWJdz3RcbY/7uOHW792X6Rl9gjHX2fYKYJYW2VMuxoJHKxzpPByCRJU8OeeCngmaDMz+93nieziqpJxecsJWSpLSw3b0= 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.201 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 2E9FB1BF211 for ; Fri, 10 May 2024 09:18:17 +0000 (UTC) From: Bastien Nocera To: linux-bluetooth@vger.kernel.org Subject: [BlueZ 09/14] media: Fix memory leak Date: Fri, 10 May 2024 11:11:07 +0200 Message-ID: <20240510091814.3172988-10-hadess@hadess.net> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240510091814.3172988-1-hadess@hadess.net> References: <20240510091814.3172988-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