提交 869a58af 编写于 作者: M Marc-André Lureau 提交者: Michael S. Tsirkin

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: NMarc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
上级 b7fcb360
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册