mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-25 04:30:02 +00:00
qemu-char: avoid potential double-free
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>
This commit is contained in:
parent
b7fcb3603c
commit
869a58af86
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user