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_subr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'slirp/tcp_subr.c') diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c index 8d0f94b75f..0270c89ae3 100644 --- a/slirp/tcp_subr.c +++ b/slirp/tcp_subr.c @@ -475,7 +475,7 @@ void tcp_connect(struct socket *inso) return; } if (tcp_attach(so) < 0) { - free(so); /* NOT sofree */ + g_free(so); /* NOT sofree */ return; } so->lhost = inso->lhost; -- cgit v1.2.3