]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qemu-char: avoid potential double-free
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Tue, 23 Feb 2016 18:10:51 +0000 (19:10 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 11 Mar 2016 14:59:12 +0000 (16:59 +0200)
If tcp_set_msgfds() is called several time with NULL fds, this
could lead to double-free.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
qemu-char.c

index e0147f3e8bd1cbd4eac6da35e56051caf79c1c3a..fc4611d3b808f4e463cbfad420ea5455298be1cc 100644 (file)
@@ -2697,6 +2697,7 @@ static int tcp_set_msgfds(CharDriverState *chr, int *fds, int num)
     }
     /* clear old pending fd array */
     g_free(s->write_msgfds);
+    s->write_msgfds = NULL;
 
     if (num) {
         s->write_msgfds = g_new(int, num);