libeis: plug a memory leak if we get more than one message per dispatch

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2020-08-13 12:22:44 +10:00
parent 2e944450a0
commit fb7bbbd4ce

View file

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