aboutsummaryrefslogtreecommitdiff
path: root/slirp/tcp_subr.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-11-06 15:13:21 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-11-10 15:07:53 +0100
commit84ec9bfaf239b61bac3e43f708772937401e0e63 (patch)
treec51ce911638e94b4a5d91079c0b85491eccf8901 /slirp/tcp_subr.c
parentc41868152a95db5f759bb7da491615eca99e9a40 (diff)
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 <peter.maydell@linaro.org> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'slirp/tcp_subr.c')
-rw-r--r--slirp/tcp_subr.c2
1 files changed, 1 insertions, 1 deletions
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;