Skip to content

Commit

Permalink
net/slirp: fix leaks on forwarding rule registration error
Browse files Browse the repository at this point in the history
Signed-off-by: Marc-André Lureau <[email protected]>
Signed-off-by: Samuel Thibault <[email protected]>
  • Loading branch information
elmarco authored and sthibaul committed Feb 7, 2019
1 parent 8d45a3b commit 8e207c3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/slirp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit 8e207c3

Please sign in to comment.