summaryrefslogtreecommitdiff
path: root/slirp/misc.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2018-05-11 21:37:25 +0200
committerPeter Wu <peter@lekensteyn.nl>2018-05-12 00:48:05 +0200
commitbfffafbb520c9eb72cfba950e245946dc7c9a59d (patch)
tree25fd8340cb45a43618e25ce73809d6d92ee4e1e9 /slirp/misc.c
parentc74e62ee3e2dc2955e07d004c71badecb68a84eb (diff)
downloadqemu-bfffafbb520c9eb72cfba950e245946dc7c9a59d.tar.gz
slirp: fix memleak of guestfwd command
Ensure that the command for the `-net user,smb=...` or `-net user,guestfwd=...-cmd:...` is freed. Reported by ASAN. Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'slirp/misc.c')
-rw-r--r--slirp/misc.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/slirp/misc.c b/slirp/misc.c
index 260187b6b6..1940a8a75f 100644
--- a/slirp/misc.c
+++ b/slirp/misc.c
@@ -59,6 +59,21 @@ int add_exec(struct ex_list **ex_ptr, int do_pty, char *exec,
return 0;
}
+void slirp_destroy_exec_list(struct ex_list *exec_list)
+{
+ struct ex_list *item = exec_list;
+ struct ex_list *next;
+
+ while (item) {
+ next = item->ex_next;
+ if (item->ex_pty == 0) {
+ /* free command only. */
+ g_free((void *)item->ex_exec);
+ }
+ g_free(item);
+ item = next;
+ }
+}
#ifdef _WIN32