Codebase list virt-viewer / 9e36a59
src: initialize keymaps variable My clang version 11.0.0 (Fedora 11.0.0-2.fc33) complains: ../src/virt-viewer-app.c:610:9: error: variable 'keymaps' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] if (keymap_string) { ^~~~~~~~~~~~~ ../src/virt-viewer-app.c:614:10: note: uninitialized use occurs here if (!keymaps || g_strv_length(keymaps) == 0) { ^~~~~~~ ../src/virt-viewer-app.c:610:5: note: remove the 'if' if its condition is always true if (keymap_string) { ^~~~~~~~~~~~~~~~~~~ ../src/virt-viewer-app.c:595:27: note: initialize the variable 'keymaps' to silence this warning gchar **key, **keymaps, **valkey, **valuekeys = NULL; ^ = NULL 1 error generated. Initialize the variable to fix the uninitialized use. Signed-off-by: Ján Tomko <jtomko@redhat.com> Ján Tomko 3 years ago
1 changed file(s) with 1 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
591591 void virt_viewer_app_set_keymap(VirtViewerApp *self, const gchar *keymap_string)
592592 {
593593 VirtViewerAppPrivate *priv = virt_viewer_app_get_instance_private(self);
594 gchar **key, **keymaps, **valkey, **valuekeys = NULL;
594 gchar **key, **keymaps = NULL, **valkey, **valuekeys = NULL;
595595 VirtViewerKeyMapping *keyMappingArray, *keyMappingPtr;
596596 guint *mappedArray, *ptrMove;
597597