|
|
f986aa |
From a2134406ab0aef44e7b710e1e2a2a40965e96692 Mon Sep 17 00:00:00 2001
|
|
|
f986aa |
From: Peter Hutterer <peter.hutterer@who-t.net>
|
|
|
f986aa |
Date: Thu, 13 Sep 2018 09:44:16 +1000
|
|
|
f986aa |
Subject: [PATCH app/xrandr] init the name to 0
|
|
|
f986aa |
|
|
|
f986aa |
There are a few conditions where coverity finds a use of an uninitialized
|
|
|
f986aa |
field of the name_t struct. These are rather messy combinations of conditions,
|
|
|
f986aa |
so let's go with the simple solution here and just init everything to 0.
|
|
|
f986aa |
This may still have side-effects but at least they'll be more obvious than the
|
|
|
f986aa |
previous "use whatever memory is leftover from breakfast".
|
|
|
f986aa |
|
|
|
f986aa |
This patch also adds a missing init_name(), much for the same reason.
|
|
|
f986aa |
|
|
|
f986aa |
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
|
f986aa |
---
|
|
|
f986aa |
xrandr.c | 2 ++
|
|
|
f986aa |
1 file changed, 2 insertions(+)
|
|
|
f986aa |
|
|
|
f986aa |
diff --git a/xrandr.c b/xrandr.c
|
|
|
f986aa |
index 7f1e867..ce3cd91 100644
|
|
|
f986aa |
--- a/xrandr.c
|
|
|
f986aa |
+++ b/xrandr.c
|
|
|
f986aa |
@@ -637,6 +637,7 @@ print_verbose_mode (const XRRModeInfo *mode, Bool current, Bool preferred)
|
|
|
f986aa |
static void
|
|
|
f986aa |
init_name (name_t *name)
|
|
|
f986aa |
{
|
|
|
f986aa |
+ memset(name, 0, sizeof(*name));
|
|
|
f986aa |
name->kind = name_none;
|
|
|
f986aa |
}
|
|
|
f986aa |
|
|
|
f986aa |
@@ -1822,6 +1823,7 @@ get_outputs (void)
|
|
|
f986aa |
output_t *output;
|
|
|
f986aa |
name_t output_name;
|
|
|
f986aa |
if (!output_info) fatal ("could not get output 0x%lx information\n", res->outputs[o]);
|
|
|
f986aa |
+ init_name(&output_name);
|
|
|
f986aa |
set_name_xid (&output_name, res->outputs[o]);
|
|
|
f986aa |
set_name_index (&output_name, o);
|
|
|
f986aa |
set_name_string (&output_name, output_info->name);
|
|
|
f986aa |
--
|
|
|
f986aa |
2.17.1
|
|
|
f986aa |
|