[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 19/20] spice-qemu-char: Fix name parameter issues af
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 19/20] spice-qemu-char: Fix name parameter issues after qapi-ifying |
Date: |
Thu, 14 Mar 2013 09:57:40 +0100 |
From: Hans de Goede <address@hidden>
The strings passed in through the qapi calls are dynamic memory, since
we want to have them stick around longer then just the call to
qemu_chr_open_spice_* we need to strdup them.
Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>
---
spice-qemu-char.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/spice-qemu-char.c b/spice-qemu-char.c
index 0c92ca8..a94f76b 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -185,6 +185,11 @@ static void spice_chr_close(struct CharDriverState *chr)
printf("%s\n", __func__);
vmc_unregister_interface(s);
QLIST_REMOVE(s, next);
+
+ g_free((char *)s->sin.subtype);
+#if SPICE_SERVER_VERSION >= 0x000c02
+ g_free((char *)s->sin.portname);
+#endif
g_free(s);
}
@@ -226,7 +231,7 @@ static CharDriverState *chr_open(const char *subtype)
s = g_malloc0(sizeof(SpiceCharDriver));
s->chr = chr;
s->active = false;
- s->sin.subtype = subtype;
+ s->sin.subtype = g_strdup(subtype);
chr->opaque = s;
chr->chr_write = spice_chr_write;
chr->chr_close = spice_chr_close;
@@ -284,7 +289,7 @@ CharDriverState *qemu_chr_open_spice_port(const char *name)
chr = chr_open("port");
s = chr->opaque;
- s->sin.portname = name;
+ s->sin.portname = g_strdup(name);
return chr;
}
--
1.7.9.7
- [Qemu-devel] [PULL v4 00/20] chardev: qapi conversion continued, Gerd Hoffmann, 2013/03/14
- [Qemu-devel] [PATCH 01/20] chardev: add support for qapi-based chardev initialization, Gerd Hoffmann, 2013/03/14
- [Qemu-devel] [PATCH 02/20] chardev: add mux chardev support to qapi, Gerd Hoffmann, 2013/03/14
- [Qemu-devel] [PATCH 04/20] chardev: add msmouse support to qapi, Gerd Hoffmann, 2013/03/14
- [Qemu-devel] [PATCH 11/20] chardev: add console support to qapi, Gerd Hoffmann, 2013/03/14
- [Qemu-devel] [PATCH 08/20] chardev: switch serial/tty init to qapi, Gerd Hoffmann, 2013/03/14
- [Qemu-devel] [PATCH 19/20] spice-qemu-char: Fix name parameter issues after qapi-ifying,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 09/20] chardev: switch parallel init to qapi, Gerd Hoffmann, 2013/03/14
- [Qemu-devel] [PATCH 03/20] chardev: switch null init to qapi, Gerd Hoffmann, 2013/03/14
- [Qemu-devel] [PATCH 15/20] chardev: add memory (ringbuf) support to qapi, Gerd Hoffmann, 2013/03/14
- [Qemu-devel] [PATCH 12/20] chardev: add pipe support to qapi, Gerd Hoffmann, 2013/03/14
- [Qemu-devel] [PATCH 10/20] chardev: switch pty init to qapi, Gerd Hoffmann, 2013/03/14
- [Qemu-devel] [PATCH 06/20] chardev: switch file init to qapi, Gerd Hoffmann, 2013/03/14
- [Qemu-devel] [PATCH 14/20] chardev: add vc support to qapi, Gerd Hoffmann, 2013/03/14
- [Qemu-devel] [PATCH 07/20] chardev: add stdio support to qapi, Gerd Hoffmann, 2013/03/14
- [Qemu-devel] [PATCH 17/20] Revert "hmp: Disable chardev-add and chardev-remove", Gerd Hoffmann, 2013/03/14
- [Qemu-devel] [PATCH 05/20] chardev: add braille support to qapi, Gerd Hoffmann, 2013/03/14