From 33f7c9ccfbf6885822d9b44307a256cf92f9b3ac Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Fri, 4 Feb 2022 02:43:49 +0100 Subject: [PATCH] Wrong pointer read. --- src/communication.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/communication.c b/src/communication.c index 1468d3b..4c822c6 100644 --- a/src/communication.c +++ b/src/communication.c @@ -478,9 +478,11 @@ struct ipc_error handle_new_message (struct ipc_event *event, struct ipc_ctx *ct ipc_message_empty (m); free (m); + int fd = ctx->pollfd[index].fd; + #ifdef DEBUG printf ("error when ipc_read: index %d fd %d error num %d, message: %s\n" - , index, ctx->pollfd[index].fd + , index, fd , ret.error_code , ret.error_message); #endif @@ -489,7 +491,7 @@ struct ipc_error handle_new_message (struct ipc_event *event, struct ipc_ctx *ct TEST_IPC_P (ipc_close (ctx, index), "cannot close a connection in handle_message"); TEST_IPC_P (ipc_del (ctx, index), "cannot delete a connection in handle_message"); - IPC_EVENT_SET (event, IPC_EVENT_TYPE_ERROR, index, ctx->pollfd[index].fd, NULL); + IPC_EVENT_SET (event, IPC_EVENT_TYPE_ERROR, index, fd, NULL); return rvalue; }