summaryrefslogtreecommitdiffstats
path: root/qemu-char.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-02-23 19:10:51 +0100
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:49:36 -0600
commit8d038b1df2dfc8566830674b0d865e82bca8933b (patch)
tree318293d88dd391d4c885137bc4444259880dc0de /qemu-char.c
parent97e38e09e4865bfd538751d48ee9e4bf4a7306b9 (diff)
downloadhqemu-8d038b1df2dfc8566830674b0d865e82bca8933b.zip
hqemu-8d038b1df2dfc8566830674b0d865e82bca8933b.tar.gz
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>
Diffstat (limited to 'qemu-char.c')
-rw-r--r--qemu-char.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/qemu-char.c b/qemu-char.c
index 3bf30b5..ce742ae 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -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);
OpenPOWER on IntegriCloud