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