From fb115a1f43e168af71486ecb4a1f54c29718a571 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 29 Jul 2020 09:41:56 +1000 Subject: [PATCH] libeis: avoid a cleanup double-free Aparently the compiler is not smart enough to handle the case correctly where a cleanup variable is introduced after a goto statement. 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 5e2e190..0902706 100644 --- a/src/libeis-client.c +++ b/src/libeis-client.c @@ -397,6 +397,7 @@ client_dispatch(struct source *source, void *data) { struct eis_client *client = data; 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)); @@ -405,8 +406,7 @@ client_dispatch(struct source *source, void *data) else if (rc < 0) goto error; - _cleanup_(message_freep) struct message *msg = - client_parse_message(iobuf_data(buf), iobuf_len(buf)); + msg = client_parse_message(iobuf_data(buf), iobuf_len(buf)); if (!msg) { rc = -EBADMSG; goto error;