aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2019-01-17 15:43:36 +0400
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-02-07 15:49:08 +0200
commit8e207c327cf89aca02ea4c7e3109d285df048d55 (patch)
tree68e917d2d07f930f609729754a539adf5ccfb07f
parent8d45a3b946b6362ed14c60b81743ca97e44d7869 (diff)
net/slirp: fix leaks on forwarding rule registration error
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
-rw-r--r--net/slirp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/slirp.c b/net/slirp.c
index 750105a466..0b15f427f5 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -807,6 +807,7 @@ static int slirp_guestfwd(SlirpState *s, const char *config_str, Error **errp)
qemu_chr_fe_init(&fwd->hd, chr, &err);
if (err) {
error_propagate(errp, err);
+ object_unparent(OBJECT(chr));
g_free(fwd);
return -1;
}
@@ -815,6 +816,7 @@ static int slirp_guestfwd(SlirpState *s, const char *config_str, Error **errp)
&server, port) < 0) {
error_setg(errp, "Conflicting/invalid host:port in guest "
"forwarding rule '%s'", config_str);
+ qemu_chr_fe_deinit(&fwd->hd, true);
g_free(fwd);
return -1;
}