[PATCH 01/32] [libx11] Using freed pointer "e"

Erkki Seppälä erkki.seppala at vincit.fi
Wed Jan 26 23:53:44 PST 2011


Reordered code to first to do the comparison and then to release data

Reviewed-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira at nokia.com>
Signed-off-by: Erkki Seppälä <erkki.seppala at vincit.fi>
---
 src/XlibInt.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/XlibInt.c b/src/XlibInt.c
index d55c26a..c385f4c 100644
--- a/src/XlibInt.c
+++ b/src/XlibInt.c
@@ -777,10 +777,10 @@ _XFreeEventCookies(Display *dpy)
     head = (struct stored_event**)&dpy->cookiejar;
 
     DL_FOREACH_SAFE(*head, e, tmp) {
-        XFree(e->ev.data);
-        XFree(e);
         if (dpy->cookiejar == e)
             dpy->cookiejar = NULL;
+        XFree(e->ev.data);
+        XFree(e);
     }
 }
 
-- 
1.7.0.4



More information about the xorg-devel mailing list