From 84ec9bfaf239b61bac3e43f708772937401e0e63 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Tue, 6 Nov 2018 15:13:21 +0000 Subject: slirp: Use g_new() to allocate sockets in socreate() The slirp socreate() function can only fail if the attempt to malloc() the struct socket fails. Switch to using g_new() instead, which will allow us to remove the error-handling code from its callers. Signed-off-by: Peter Maydell Signed-off-by: Samuel Thibault --- slirp/tcp_input.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'slirp/tcp_input.c') diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c index 07bcbdb2dd..4f79c95fdb 100644 --- a/slirp/tcp_input.c +++ b/slirp/tcp_input.c @@ -432,8 +432,8 @@ findso: if ((so = socreate(slirp)) == NULL) goto dropwithreset; if (tcp_attach(so) < 0) { - free(so); /* Not sofree (if it failed, it's not insqued) */ - goto dropwithreset; + g_free(so); /* Not sofree (if it failed, it's not insqued) */ + goto dropwithreset; } sbreserve(&so->so_snd, TCP_SNDSPACE); -- cgit v1.2.3-55-g7522