From fb7bbbd4cea82370d13a5de456b5b84584183e5b Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 13 Aug 2020 12:22:44 +1000 Subject: [PATCH] libeis: plug a memory leak if we get more than one message per dispatch Signed-off-by: Peter Hutterer --- src/libeis-client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libeis-client.c b/src/libeis-client.c index 73479d5..63f588c 100644 --- a/src/libeis-client.c +++ b/src/libeis-client.c @@ -618,8 +618,6 @@ client_dispatch(struct source *source, void *userdata) { struct eis_client *client = userdata; enum eis_client_state old_state = client->state; - _cleanup_(message_freep) struct message *msg = NULL; - _cleanup_iobuf_ struct iobuf *buf = iobuf_new(64); int rc = iobuf_append_from_fd(buf, source_get_fd(source)); if (rc == -EAGAIN) { @@ -635,6 +633,8 @@ client_dispatch(struct source *source, void *userdata) size_t idx = 0; while (rc == 0) { + _cleanup_(message_freep) struct message *msg = NULL; + const char *data = iobuf_data(buf) + idx; size_t len = iobuf_len(buf) - idx;