From 722b3ac972026284d526c1fd8029115006e5f771 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Wed, 3 Dec 2008 04:34:06 +0000 Subject: [PATCH] (Fx_get_cut_buffer_internal): Fix memory leak. --- src/xselect.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/xselect.c b/src/xselect.c index 7573be894d8..ce106f3ddac 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -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), -- 2.39.2