[glib: 1/6] tests: NULL-initialise some variables to help scan-build
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/6] tests: NULL-initialise some variables to help scan-build
- Date: Tue, 7 Jun 2022 10:50:18 +0000 (UTC)
commit 14f4b38fb1c7c14251433a2f0c53e786b4f6f587
Author: Philip Withnall <pwithnall endlessos org>
Date: Tue Jun 7 11:04:25 2022 +0100
tests: NULL-initialise some variables to help scan-build
Dynamically, these will only ever be used after they’ve been initialised
due to correct checking of `use_udp` throughout the test. However,
that’s a global variable and the static analyser is assuming it might
change value. So help it out by NULL-initialising the variables so they
can never be used uninitialised.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
gio/tests/socket-client.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gio/tests/socket-client.c b/gio/tests/socket-client.c
index 92bf41fb97..0256327679 100644
--- a/gio/tests/socket-client.c
+++ b/gio/tests/socket-client.c
@@ -249,14 +249,14 @@ int
main (int argc,
char *argv[])
{
- GSocket *socket;
- GSocketAddress *address;
+ GSocket *socket = NULL;
+ GSocketAddress *address = NULL;
GError *error = NULL;
GOptionContext *context;
GCancellable *cancellable;
- GIOStream *connection;
- GInputStream *istream;
- GOutputStream *ostream;
+ GIOStream *connection = NULL;
+ GInputStream *istream = NULL;
+ GOutputStream *ostream = NULL;
GSocketAddress *src_address = NULL;
GTlsCertificate *certificate = NULL;
gint i;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]