From e3a69d1932a86125ec860148006c14a234767127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Sat, 7 Oct 2023 02:26:50 +0200 Subject: [PATCH] pulse-server: use `spa_autofree` with `open_memstream()` Coverity is saying that `response_str` is leaked on the return if `fclose()` returns non-zero. So use `spa_autofree` to fix that. --- src/modules/module-protocol-pulse/pulse-server.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c index 1825771d0..3711717a5 100644 --- a/src/modules/module-protocol-pulse/pulse-server.c +++ b/src/modules/module-protocol-pulse/pulse-server.c @@ -5101,7 +5101,7 @@ static int do_send_object_message(struct client *client, uint32_t command, uint3 struct pw_manager *manager = client->manager; const char *object_path = NULL, *message = NULL, *params = NULL; struct pw_manager_object *o; - char *response_str = NULL; + spa_autofree char *response_str = NULL; size_t path_len = 0, response_len = 0; FILE *response; int res = -ENOENT; @@ -5155,8 +5155,6 @@ static int do_send_object_message(struct client *client, uint32_t command, uint3 res = client_queue_message(client, reply); } - free(response_str); - return res; }