Blame SOURCES/0009-x11-Change-check-to-make-code-scanners-not-giving-wa.patch

0985ad
From 0b94306d2c1305aee1c56bc9f927f95371484844 Mon Sep 17 00:00:00 2001
0985ad
From: Frediano Ziglio <fziglio@redhat.com>
0985ad
Date: Sat, 20 Jul 2019 14:42:10 +0100
0985ad
Subject: [PATCH 9/9] x11: Change check to make code scanners not giving
0985ad
 warning
0985ad
0985ad
Some code scanners (both Coverity and clang one) report that
0985ad
prev_sel/prev_cond could be unreferenced while NULL.
0985ad
Change condition to make clear a NULL pointer is not used.
0985ad
0985ad
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
0985ad
Acked-by: Victor Toso <victortoso@redhat.com>
0985ad
---
0985ad
 src/vdagent/x11.c | 6 ++----
0985ad
 1 file changed, 2 insertions(+), 4 deletions(-)
0985ad
0985ad
diff --git a/src/vdagent/x11.c b/src/vdagent/x11.c
0985ad
index 966ea62..6f83849 100644
0985ad
--- a/src/vdagent/x11.c
0985ad
+++ b/src/vdagent/x11.c
0985ad
@@ -392,7 +392,7 @@ static void vdagent_x11_set_clipboard_owner(struct vdagent_x11 *x11,
0985ad
                 once = 0;
0985ad
             }
0985ad
             vdagent_x11_send_selection_notify(x11, None, curr_sel);
0985ad
-            if (curr_sel == x11->selection_req) {
0985ad
+            if (prev_sel == NULL) {
0985ad
                 x11->selection_req = next_sel;
0985ad
                 free(x11->selection_req_data);
0985ad
                 x11->selection_req_data = NULL;
0985ad
@@ -400,7 +400,6 @@ static void vdagent_x11_set_clipboard_owner(struct vdagent_x11 *x11,
0985ad
                 x11->selection_req_data_size = 0;
0985ad
                 x11->selection_req_atom = None;
0985ad
             } else {
0985ad
-                // coverity[var_deref_op] if it is not the first there's a previous
0985ad
                 prev_sel->next = next_sel;
0985ad
             }
0985ad
             free(curr_sel);
0985ad
@@ -424,12 +423,11 @@ static void vdagent_x11_set_clipboard_owner(struct vdagent_x11 *x11,
0985ad
             if (x11->vdagentd)
0985ad
                 udscs_write(x11->vdagentd, VDAGENTD_CLIPBOARD_DATA, selection,
0985ad
                             VD_AGENT_CLIPBOARD_NONE, NULL, 0);
0985ad
-            if (curr_conv == x11->conversion_req) {
0985ad
+            if (prev_conv == NULL) {
0985ad
                 x11->conversion_req = next_conv;
0985ad
                 x11->clipboard_data_size = 0;
0985ad
                 x11->expect_property_notify = 0;
0985ad
             } else {
0985ad
-                // coverity[var_deref_op] if it is not the first there's a previous
0985ad
                 prev_conv->next = next_conv;
0985ad
             }
0985ad
             free(curr_conv);
0985ad
-- 
0985ad
2.21.0
0985ad