summaryrefslogtreecommitdiffstats
path: root/chardev
diff options
context:
space:
mode:
authorPeter Xu2018-03-01 09:44:24 +0100
committerPaolo Bonzini2018-03-06 14:01:27 +0100
commit8b2ec54ff39c319dcb12e430d9e69d081395b964 (patch)
tree031a3e0be04e5659a996e021e9d031e0e1879f6f /chardev
parentsdhci-test: fix leaks (diff)
downloadqemu-8b2ec54ff39c319dcb12e430d9e69d081395b964.tar.gz
qemu-8b2ec54ff39c319dcb12e430d9e69d081395b964.tar.xz
qemu-8b2ec54ff39c319dcb12e430d9e69d081395b964.zip
chardev: fix leak in tcp_chr_telnet_init_io()
Need to free TCPChardevTelnetInit when session established. Since at it, switch to use G_SOURCE_* macros. Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <20180301084438.13594-2-peterx@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'chardev')
-rw-r--r--chardev/char-socket.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index 22f65971a1..8401aaed1a 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -592,19 +592,23 @@ static gboolean tcp_chr_telnet_init_io(QIOChannel *ioc,
ret = 0;
} else {
tcp_chr_disconnect(init->chr);
- return FALSE;
+ goto end;
}
}
init->buflen -= ret;
if (init->buflen == 0) {
tcp_chr_connect(init->chr);
- return FALSE;
+ goto end;
}
memmove(init->buf, init->buf + ret, init->buflen);
- return TRUE;
+ return G_SOURCE_CONTINUE;
+
+end:
+ g_free(init);
+ return G_SOURCE_REMOVE;
}
static void tcp_chr_telnet_init(Chardev *chr)