| 1 |
From: Micael Vinicius Lira Prado <[email protected]> |
| 2 |
Date: Mon, 29 Jun 2026 10:38:10 -0300 |
| 3 |
Subject: Bug#1139320: [PATCH] lib/ipc: free client input buffer in |
| 4 |
maybe_close |
| 5 |
MIME-Version: 1.0 |
| 6 |
Content-Type: text/plain; charset="utf-8" |
| 7 |
Content-Transfer-Encoding: 8bit |
| 8 |
|
| 9 |
The input buffer (c->inmsg) is allocated in handle_read() using |
| 10 |
erealloc(), but it is never released when the client is destroyed. |
| 11 |
|
| 12 |
Free the input buffer before freeing the client structure to avoid |
| 13 |
leaking memory on every closed IPC connection. |
| 14 |
|
| 15 |
Signed-off-by: Micael Prado <[email protected]> |
| 16 |
Co-developed-by: João Marinho <[email protected]> |
| 17 |
Signed-off-by: João Marinho <[email protected]> |
| 18 |
--- |
| 19 |
lib/ipc/server.c | 1 + |
| 20 |
1 file changed, 1 insertion(+) |
| 21 |
|
| 22 |
diff --git a/lib/ipc/server.c b/lib/ipc/server.c |
| 23 |
index 482b919..46d4940 100644 |
| 24 |
--- a/lib/ipc/server.c |
| 25 |
+++ b/lib/ipc/server.c |
| 26 |
@@ -693,6 +693,7 @@ maybe_close(struct client *c) |
| 27 |
dispatch_release(c->out); |
| 28 |
#endif |
| 29 |
close(c->fd); /* ref count fd close */ |
| 30 |
+ free(c->inmsg); |
| 31 |
free(c); |
| 32 |
return 1; |
| 33 |
} |