(Fx_get_cut_buffer_internal): Fix memory leak.
authorChong Yidong <cyd@stupidchicken.com>
Wed, 3 Dec 2008 04:34:06 +0000 (04:34 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Wed, 3 Dec 2008 04:34:06 +0000 (04:34 +0000)
src/xselect.c

index 7573be8..ce106f3 100644 (file)
@@ -2392,9 +2392,16 @@ DEFUN ("x-get-cut-buffer-internal", Fx_get_cut_buffer_internal,
 
   x_get_window_property (display, window, buffer_atom, &data, &bytes,
                         &type, &format, &size, 0);
-  if (!data || !format)
+
+  if (!data)
     return Qnil;
 
+  if (!format)
+    {
+      xfree (data);
+      return Qnil;
+    }
+
   if (format != 8 || type != XA_STRING)
     signal_error ("Cut buffer doesn't contain 8-bit data",
                  list2 (x_atom_to_symbol (display, type),