[gtk+] gdkwindow: Fix potential NULL pointer dereference



commit 586240d2f8ef5408c24b5636047487e844f309ee
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Wed Nov 20 17:18:16 2013 +0000

    gdkwindow: Fix potential NULL pointer dereference
    
    gdk_window_ensure_native() can end up with a NULL parent pointer, which
    it passes to find_native_parent_above()…but that expects a non-NULL
    parent.
    
    Found with scan-build.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=712760

 gdk/gdkwindow.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 9ab1f8a..a5174a7 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -1110,6 +1110,9 @@ find_native_sibling_above (GdkWindow *parent,
 {
   GdkWindow *w;
 
+  if (!parent)
+    return NULL;
+
   w = find_native_sibling_above_helper (parent, child);
   if (w)
     return w;


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