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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Victor Toso <me@xxxxxxxxxxxxxx>

Found by coverity:
  | warning: Access to field 'next' results in a dereference of a
  | null pointer (loaded from variable 'prev_sel')

Signed-off-by: Victor Toso <victortoso@xxxxxxxxxx>
---
 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 c3c7a65..69eed4a 100644
--- a/src/vdagent/x11.c
+++ b/src/vdagent/x11.c
@@ -394,7 +394,7 @@ static void vdagent_x11_set_clipboard_owner(struct vdagent_x11 *x11,
                 x11->selection_req_data_pos = 0;
                 x11->selection_req_data_size = 0;
                 x11->selection_req_atom = None;
-            } else {
+            } else if (prev_sel != NULL) {
                 prev_sel->next = next_sel;
             }
             free(curr_sel);
-- 
2.19.2

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]