mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-09-20 01:06:15 +02:00
gsocket: Clear address before filling it
This will probably make no functional difference, but will squash two warnings from scan-build: ``` ../../../../source/glib/gio/gsocket.c:503:14: warning: Assigned value is garbage or undefined [core.uninitialized.Assign] family = address.storage.ss_family; ^ ~~~~~~~~~~~~~~~~~~~~~~~~~ ../../../../source/glib/gio/gsocket.c:527:29: warning: Assigned value is garbage or undefined [core.uninitialized.Assign] socket->priv->family = address.storage.ss_family; ^ ~~~~~~~~~~~~~~~~~~~~~~~~~ ``` It seems like a reasonable thing to warn about. Initialising the full union to zero should avoid any possibility of undefined behaviour like that. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Helps: #1767
This commit is contained in:
parent
c02890645b
commit
7f83151ac0
@ -463,6 +463,8 @@ g_socket_details_from_fd (GSocket *socket)
|
||||
int value, family;
|
||||
int errsv;
|
||||
|
||||
memset (&address, 0, sizeof (address));
|
||||
|
||||
fd = socket->priv->fd;
|
||||
if (!g_socket_get_option (socket, SOL_SOCKET, SO_TYPE, &value, NULL))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user