[Spice-devel] [spice-server] stat: Silence gcc warning
Christophe Fergeau
cfergeau at redhat.com
Fri Jan 20 15:30:21 UTC 2017
Initializing 'node' to NULL silences this warning:
stat-file.c: In function 'stat_file_add_node':
stat-file.c:180:15: error: 'node' may be used uninitialized in this function [-Werror=maybe-uninitialized]
g_strlcpy(node->name, name, sizeof(node->name));
^~~~
cc1: all warnings being treated as errors
---
server/stat-file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/server/stat-file.c b/server/stat-file.c
index c23f4f5..de455b6 100644
--- a/server/stat-file.c
+++ b/server/stat-file.c
@@ -144,7 +144,7 @@ StatNodeRef
stat_file_add_node(RedStatFile *stat_file, StatNodeRef parent, const char *name, int visible)
{
StatNodeRef ref;
- SpiceStatNode *node;
+ SpiceStatNode *node = NULL;
spice_assert(name && strlen(name) > 0);
if (strlen(name) >= sizeof(node->name)) {
--
2.9.3
More information about the Spice-devel
mailing list