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 <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2020-07-29 09:41:56 +10:00
parent b840c510bf
commit fb115a1f43

View file

@ -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;