mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
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:
parent
c41868152a
commit
84ec9bfaf2
3 changed files with 9 additions and 11 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue