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>
This commit is contained in:
Peter Maydell 2018-11-06 15:13:21 +00:00 committed by Samuel Thibault
parent c41868152a
commit 84ec9bfaf2
3 changed files with 9 additions and 11 deletions

View file

@ -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;