aboutsummaryrefslogtreecommitdiff
path: root/slirp/tcp_input.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_input.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_input.c')
-rw-r--r--slirp/tcp_input.c4
1 files changed, 2 insertions, 2 deletions
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);