From 02c25c150d000ac15f0a3d21635b6aaa96a3aeee Mon Sep 17 00:00:00 2001 From: Karchnu Date: Fri, 10 Jul 2020 23:43:11 +0200 Subject: [PATCH] fixing a memory leak --- src/network.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/network.c b/src/network.c index 572f694..21888b5 100644 --- a/src/network.c +++ b/src/network.c @@ -328,9 +328,11 @@ struct ipc_error fd_switching_read (struct ipc_event *event, struct ipc_ctx *ctx // 1. put the message in the list to be sent m.fd = dest_fd; ipc_write (ctx, &m); - // 2. set event IPC_EVENT_TYPE_SWITCH, inform ipcd of a successful reception. + // 2. delete the message (a deep copy has been made) + ipc_message_empty (&m); + // 3. set event IPC_EVENT_TYPE_SWITCH, inform ipcd of a successful reception. IPC_EVENT_SET (event, IPC_EVENT_TYPE_SWITCH, index, ctx->pollfd[index].fd, NULL); - // 3. IPC_RETURN_NO_ERROR + // 4. IPC_RETURN_NO_ERROR IPC_RETURN_NO_ERROR; }