[Spice-devel] [linux-vdagent PATCH v1] uinput: avoid double free

Victor Toso victortoso at redhat.com
Mon Sep 14 23:55:00 PDT 2015


commit 4835df0b642dfc963e7 fixed a leak but by not setting pointer to
NULL it could lead to double free.

Resolve: https://bugzilla.redhat.com/show_bug.cgi?id=1262635
---
 src/vdagentd-uinput.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/vdagentd-uinput.c b/src/vdagentd-uinput.c
index 1ce9918..446c0ed 100644
--- a/src/vdagentd-uinput.c
+++ b/src/vdagentd-uinput.c
@@ -77,8 +77,10 @@ void vdagentd_uinput_destroy(struct vdagentd_uinput **uinputp)
     if (uinput->fd != -1)
         close(uinput->fd);
 
-    if (uinput->screen_info != NULL)
+    if (uinput->screen_info != NULL) {
         free(uinput->screen_info);
+        uinput->screen_info = NULL;
+    }
 
     free(uinput);
     *uinputp = NULL;
-- 
2.4.3



More information about the Spice-devel mailing list