On Thu, May 12, 2016 at 10:33:05PM +0530, Ashijeet Acharya wrote: > Changed the listen(),connect(),parse_host_port() in net/socket.c with the > socket_*()functions in include/qemu/sockets.h.
What is the rationale for this change? Please explain why this is necessary or a good idea. Please summarize the address syntax changes in this patch and update the QEMU man page. > > Signed-off-by: Ashijeet Acharya <ashijeetacha...@gmail.com> > --- > net/socket.c | 38 +++++++++++++++++++------------------- > 1 file changed, 19 insertions(+), 19 deletions(-) > > diff --git a/net/socket.c b/net/socket.c > index 9fa2cd8..b6e2f3e 100644 > --- a/net/socket.c > +++ b/net/socket.c > @@ -522,10 +522,12 @@ static int net_socket_listen_init(NetClientState *peer, > { > NetClientState *nc; > NetSocketState *s; > - struct sockaddr_in saddr; > + SocketAddress *saddr; > int fd, ret; > + Error *local_error = NULL; > + saddr = g_new0(SocketAddress, 1); > > - if (parse_host_port(&saddr, host_str) < 0) > + if (socket_parse(host_str, &local_error) < 0) > return -1; saddr is leaked. Please check all return code paths and avoid memory leaks. I'm not sure if it makes sense to allocate a new SocketAddress object since it is assigned a different object further down in the patch: saddr = socket_local_address(fd, &local_error);
signature.asc
Description: PGP signature