diff options
Diffstat (limited to 'gdk/x11/gdkselection-x11.c')
-rw-r--r-- | gdk/x11/gdkselection-x11.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gdk/x11/gdkselection-x11.c b/gdk/x11/gdkselection-x11.c index f1abc01cf..fb89a3d85 100644 --- a/gdk/x11/gdkselection-x11.c +++ b/gdk/x11/gdkselection-x11.c @@ -109,6 +109,7 @@ gdk_selection_property_get (GdkWindow *requestor, if (private->destroyed) return 0; + t = NULL; XGetWindowProperty (private->xdisplay, private->xwindow, gdk_selection_property, 0, 0, False, AnyPropertyType, &prop_type, &prop_format, @@ -125,7 +126,11 @@ gdk_selection_property_get (GdkWindow *requestor, return 0; } - XFree (t); + if (t) + { + t = NULL; + XFree (t); + } /* Add on an extra byte to handle null termination. X guarantees that t will be 1 longer than nbytes and null terminated */ @@ -144,7 +149,8 @@ gdk_selection_property_get (GdkWindow *requestor, { *data = g_new (guchar, length); memcpy (*data, t, length); - XFree (t); + if (t) + XFree (t); return length-1; } else @@ -205,6 +211,8 @@ gdk_text_property_to_text_list (GdkAtom encoding, gint format, void gdk_free_text_list (gchar **list) { + g_return_if_fail (list != NULL); + XFreeStringList (list); } |