[Spice-devel] [linux-agent v1 5/5] x11: Avoid dereference of a null pointer

Victor Toso victortoso at redhat.com
Tue Dec 18 16:18:06 UTC 2018


From: Victor Toso <me at victortoso.com>

Similar to previous patch, found by coverity:
  | var_deref_op: Dereferencing null pointer "prev_conv".

Signed-off-by: Victor Toso <victortoso at redhat.com>
---
 src/vdagent/x11.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/vdagent/x11.c b/src/vdagent/x11.c
index 69eed4a..50b6674 100644
--- a/src/vdagent/x11.c
+++ b/src/vdagent/x11.c
@@ -422,7 +422,7 @@ static void vdagent_x11_set_clipboard_owner(struct vdagent_x11 *x11,
                 x11->conversion_req = next_conv;
                 x11->clipboard_data_size = 0;
                 x11->expect_property_notify = 0;
-            } else {
+            } else if (prev_conv != NULL) {
                 prev_conv->next = next_conv;
             }
             free(curr_conv);
-- 
2.19.2



More information about the Spice-devel mailing list