From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36546) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur02L-0004v6-0e for qemu-devel@nongnu.org; Mon, 24 Jun 2013 02:14:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ur02J-0007KM-WA for qemu-devel@nongnu.org; Mon, 24 Jun 2013 02:14:00 -0400 Message-ID: <51C7E3A2.3050301@redhat.com> Date: Mon, 24 Jun 2013 08:13:54 +0200 From: Gerd Hoffmann MIME-Version: 1.0 References: <1371811105-730-1-git-send-email-kraxel@redhat.com> <1371811105-730-2-git-send-email-kraxel@redhat.com> <51C4985E.1020204@msgid.tls.msk.ru> In-Reply-To: <51C4985E.1020204@msgid.tls.msk.ru> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH 01/13] qemu-socket: zero-initialize SocketAddress List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Tokarev Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org On 06/21/13 20:15, Michael Tokarev wrote: > 21.06.2013 14:38, Gerd Hoffmann wrote: >> Signed-off-by: Gerd Hoffmann >> --- >> util/qemu-sockets.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c >> index fdd8dc4..364bd8c 100644 >> --- a/util/qemu-sockets.c >> +++ b/util/qemu-sockets.c >> @@ -855,7 +855,7 @@ SocketAddress *socket_parse(const char *str, Error **errp) >> { >> SocketAddress *addr = NULL; >> >> - addr = g_new(SocketAddress, 1); >> + addr = g_new0(SocketAddress, 1); > > While at it we can remove the =NULL assignment too, guess, someting like this: > > --- a/util/qemu-sockets.c > +++ b/util/qemu-sockets.c > @@ -848,9 +848,7 @@ int unix_nonblocking_connect(const char *path, > > SocketAddress *socket_parse(const char *str, Error **errp) > { > - SocketAddress *addr = NULL; > - > - addr = g_new(SocketAddress, 1); > + SocketAddress *addr = addr = g_new0(SocketAddress, 1); > if (strstart(str, "unix:", NULL)) { > if (str[5] == '\0') { > error_setg(errp, "invalid Unix socket address"); > > Is that okay with you? :) Yes. > And not that the original issue is a big issue really, because > in each case each relevant field is initialized. Except in the error cases. cheers, Gerd