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