virt-viewer/0001-src-initialize-keymaps-variable.patch
2021-11-16 07:28:19 +00:00

48 lines
1.8 KiB
Diff

From 9e36a59c806de3de77c046df0b8c80bd9a0f4863 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Fri, 23 Apr 2021 15:58:56 +0200
Subject: [PATCH] src: initialize keymaps variable
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
---
src/virt-viewer-app.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 0095398..de2677c 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -592,7 +592,7 @@ static
void virt_viewer_app_set_keymap(VirtViewerApp *self, const gchar *keymap_string)
{
VirtViewerAppPrivate *priv = virt_viewer_app_get_instance_private(self);
- gchar **key, **keymaps, **valkey, **valuekeys = NULL;
+ gchar **key, **keymaps = NULL, **valkey, **valuekeys = NULL;
VirtViewerKeyMapping *keyMappingArray, *keyMappingPtr;
guint *mappedArray, *ptrMove;
--
2.31.1