From 8e207c327cf89aca02ea4c7e3109d285df048d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 17 Jan 2019 15:43:36 +0400 Subject: [PATCH] net/slirp: fix leaks on forwarding rule registration error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau Signed-off-by: Samuel Thibault --- net/slirp.c | 2 ++ 1 file changed, 2 insertions(+) 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; }