[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/64] slirp: fix slirp_add_exec() leaks
From: |
Samuel Thibault |
Subject: |
[Qemu-devel] [PULL 09/64] slirp: fix slirp_add_exec() leaks |
Date: |
Wed, 19 Dec 2018 00:03:47 +0100 |
From: Marc-André Lureau <address@hidden>
Free the list elements allocated in add_exec().
Signed-off-by: Marc-André Lureau <address@hidden>
Signed-off-by: Samuel Thibault <address@hidden>
---
slirp/misc.h | 2 +-
slirp/slirp.c | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/slirp/misc.h b/slirp/misc.h
index 94829722cd..0bc5e74bc5 100644
--- a/slirp/misc.h
+++ b/slirp/misc.h
@@ -12,7 +12,7 @@ struct ex_list {
void *ex_chardev;
struct in_addr ex_addr; /* Server address */
int ex_fport; /* Port to telnet to */
- const char *ex_exec; /* Command line of what to exec */
+ char *ex_exec; /* Command line of what to exec */
struct ex_list *ex_next;
};
diff --git a/slirp/slirp.c b/slirp/slirp.c
index 4c9ba9d428..0e4ade3e4a 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -342,6 +342,14 @@ Slirp *slirp_init(int restricted, bool in_enabled, struct
in_addr vnetwork,
void slirp_cleanup(Slirp *slirp)
{
+ struct ex_list *e, *next;
+
+ for (e = slirp->exec_list; e; e = next) {
+ next = e->ex_next;
+ g_free(e->ex_exec);
+ g_free(e);
+ }
+
QTAILQ_REMOVE(&slirp_instances, slirp, entry);
unregister_savevm(NULL, "slirp", slirp);
--
2.19.2
- [Qemu-devel] [PULL 00/64] slirp updates, Samuel Thibault, 2018/12/18
- [Qemu-devel] [PULL 03/64] slirp: replace ex_pty with ex_chardev, Samuel Thibault, 2018/12/18
- [Qemu-devel] [PULL 01/64] slirp: associate slirp_output callback with the Slirp context, Samuel Thibault, 2018/12/18
- [Qemu-devel] [PULL 05/64] slirp: remove unused EMU_RSH, Samuel Thibault, 2018/12/18
- [Qemu-devel] [PULL 02/64] slirp: remove do_pty from fork_exec(), Samuel Thibault, 2018/12/18
- [Qemu-devel] [PULL 09/64] slirp: fix slirp_add_exec() leaks,
Samuel Thibault <=
- [Qemu-devel] [PULL 04/64] slirp: use a dedicated field for chardev pointer, Samuel Thibault, 2018/12/18
- [Qemu-devel] [PULL 12/64] slirp: add tftp tracing, Samuel Thibault, 2018/12/18
- [Qemu-devel] [PULL 07/64] slirp: move internal function declarations, Samuel Thibault, 2018/12/18
- [Qemu-devel] [PULL 11/64] slirp: remove dead declarations, Samuel Thibault, 2018/12/18
- [Qemu-devel] [PULL 19/64] slirp: remove HAVE_SYS_SIGNAL_H, Samuel Thibault, 2018/12/18
- [Qemu-devel] [PULL 14/64] slirp: remove unused M_TRAILINGSPACE, Samuel Thibault, 2018/12/18
- [Qemu-devel] [PULL 24/64] slirp: remove unused HAVE_SYS_WAIT_H, Samuel Thibault, 2018/12/18
- [Qemu-devel] [PULL 13/64] slirp: move socket pair creation in helper function, Samuel Thibault, 2018/12/18
- [Qemu-devel] [PULL 20/64] slirp: remove unused HAVE_SYS_BITYPES_H, Samuel Thibault, 2018/12/18
- [Qemu-devel] [PULL 06/64] slirp: rename /extra/chardev, Samuel Thibault, 2018/12/18