[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-bluetooth
Subject: [BlueZ 09/14] media: Fix memory leak
From: Bastien Nocera <hadess () hadess ! net>
Date: 2024-05-10 9:11:07
Message-ID: 20240510091814.3172988-10-hadess () hadess ! net
[Download RAW message or body]
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic