summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2019-07-20 14:42:10 +0100
committerFrediano Ziglio <fziglio@redhat.com>2019-07-24 10:32:44 +0100
commit0b94306d2c1305aee1c56bc9f927f95371484844 (patch)
tree012b2f3c8d9c7984d14f4950d47c117ea899608b
parent66935d134e1f359eda5cfac053b0bf716811670a (diff)
x11: Change check to make code scanners not giving warning
Some code scanners (both Coverity and clang one) report that prev_sel/prev_cond could be unreferenced while NULL. Change condition to make clear a NULL pointer is not used. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
-rw-r--r--src/vdagent/x11.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/vdagent/x11.c b/src/vdagent/x11.c
index 966ea62..6f83849 100644
--- a/src/vdagent/x11.c
+++ b/src/vdagent/x11.c
@@ -392,7 +392,7 @@ static void vdagent_x11_set_clipboard_owner(struct vdagent_x11 *x11,
once = 0;
}
vdagent_x11_send_selection_notify(x11, None, curr_sel);
- if (curr_sel == x11->selection_req) {
+ if (prev_sel == NULL) {
x11->selection_req = next_sel;
free(x11->selection_req_data);
x11->selection_req_data = NULL;
@@ -400,7 +400,6 @@ static void vdagent_x11_set_clipboard_owner(struct vdagent_x11 *x11,
x11->selection_req_data_size = 0;
x11->selection_req_atom = None;
} else {
- // coverity[var_deref_op] if it is not the first there's a previous
prev_sel->next = next_sel;
}
free(curr_sel);
@@ -424,12 +423,11 @@ static void vdagent_x11_set_clipboard_owner(struct vdagent_x11 *x11,
if (x11->vdagentd)
udscs_write(x11->vdagentd, VDAGENTD_CLIPBOARD_DATA, selection,
VD_AGENT_CLIPBOARD_NONE, NULL, 0);
- if (curr_conv == x11->conversion_req) {
+ if (prev_conv == NULL) {
x11->conversion_req = next_conv;
x11->clipboard_data_size = 0;
x11->expect_property_notify = 0;
} else {
- // coverity[var_deref_op] if it is not the first there's a previous
prev_conv->next = next_conv;
}
free(curr_conv);