public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v1] media: fix memory leak in endpoint_init_pac()
@ 2024-06-27 13:05 Roman Smirnov
  2024-06-27 14:43 ` [BlueZ,v1] " bluez.test.bot
  2024-06-27 18:40 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Roman Smirnov @ 2024-06-27 13:05 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Roman Smirnov

asprintf() allocates memory in the name variable but does not
free it before exiting the function, which causes a memory leak.

Add freeing of the name variable before exiting.

Found by Linux Verification Center (linuxtesting.org) with the SVACE
static analysis tool.
---
 profiles/audio/media.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index b5644736a..746e538fc 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -1280,6 +1280,7 @@ static bool endpoint_init_pac(struct media_endpoint *endpoint, uint8_t type,
 	if (asprintf(&name, "%s:%s", endpoint->sender, endpoint->path) < 0) {
 		error("Could not allocate name for pac %s:%s",
 				endpoint->sender, endpoint->path);
+		free(name);
 		return false;
 	}
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [BlueZ,v1] media: fix memory leak in endpoint_init_pac()
  2024-06-27 13:05 [PATCH BlueZ v1] media: fix memory leak in endpoint_init_pac() Roman Smirnov
@ 2024-06-27 14:43 ` bluez.test.bot
  2024-06-27 18:40 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2024-06-27 14:43 UTC (permalink / raw)
  To: linux-bluetooth, r.smirnov

[-- Attachment #1: Type: text/plain, Size: 948 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=866157

---Test result---

Test Summary:
CheckPatch                    PASS      0.37 seconds
GitLint                       PASS      0.27 seconds
BuildEll                      PASS      24.58 seconds
BluezMake                     PASS      1730.99 seconds
MakeCheck                     PASS      13.51 seconds
MakeDistcheck                 PASS      177.37 seconds
CheckValgrind                 PASS      251.53 seconds
CheckSmatch                   PASS      353.45 seconds
bluezmakeextell               PASS      119.35 seconds
IncrementalBuild              PASS      1473.21 seconds
ScanBuild                     PASS      991.71 seconds



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ v1] media: fix memory leak in endpoint_init_pac()
  2024-06-27 13:05 [PATCH BlueZ v1] media: fix memory leak in endpoint_init_pac() Roman Smirnov
  2024-06-27 14:43 ` [BlueZ,v1] " bluez.test.bot
@ 2024-06-27 18:40 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2024-06-27 18:40 UTC (permalink / raw)
  To: Roman Smirnov; +Cc: linux-bluetooth

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Thu, 27 Jun 2024 16:05:51 +0300 you wrote:
> asprintf() allocates memory in the name variable but does not
> free it before exiting the function, which causes a memory leak.
> 
> Add freeing of the name variable before exiting.
> 
> Found by Linux Verification Center (linuxtesting.org) with the SVACE
> static analysis tool.
> 
> [...]

Here is the summary with links:
  - [BlueZ,v1] media: fix memory leak in endpoint_init_pac()
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=bf4ec513929b

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-27 18:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-27 13:05 [PATCH BlueZ v1] media: fix memory leak in endpoint_init_pac() Roman Smirnov
2024-06-27 14:43 ` [BlueZ,v1] " bluez.test.bot
2024-06-27 18:40 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox