summaryrefslogtreecommitdiff
path: root/src/xselect.c
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2014-07-04 06:28:54 +0400
committerDmitry Antipov <dmantipov@yandex.ru>2014-07-04 06:28:54 +0400
commit9d7b0167fdd06638e019103ef1b77e5956d7fb7b (patch)
treea086d81baec06b2656eb96437935632d1862d497 /src/xselect.c
parent2b13ca4d11960fe1d8b858a64864d7b74bf60867 (diff)
downloademacs-9d7b0167fdd06638e019103ef1b77e5956d7fb7b.tar.gz
* font.h (struct font_driver): Remove get_outline and free_outline;
not used by any font driver. * ftfont.c (ftfont_driver): * macfont.m (macfont_driver): * nsfont.m (nsfont_driver): * w32font.c (w32font_driver): * w32uniscribe.c (uniscribe_font_driver): * xfont.c (xfont_driver): Related users changed. * xselect.c (x_get_window_property): Use convenient xmalloc. Call to xfree only if some data was really allocated.
Diffstat (limited to 'src/xselect.c')
-rw-r--r--src/xselect.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/xselect.c b/src/xselect.c
index 89ec1da30b2..f23256346cb 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -1299,9 +1299,7 @@ x_get_window_property (Display *display, Window window, Atom property,
if (total_size_max < bytes_remaining)
goto size_overflow;
total_size = bytes_remaining;
- data = malloc (total_size + 1);
- if (! data)
- goto memory_exhausted;
+ data = xmalloc (total_size + 1);
/* Now read, until we've gotten it all. */
while (bytes_remaining)
@@ -1352,9 +1350,7 @@ x_get_window_property (Display *display, Window window, Atom property,
if (remaining_lim < 0 || remaining_lim < bytes_remaining)
goto size_overflow;
total_size = offset + bytes_gotten + bytes_remaining;
- data1 = realloc (data, total_size + 1);
- if (! data1)
- goto memory_exhausted;
+ data1 = xrealloc (data, total_size + 1);
data = data1;
}
@@ -1386,14 +1382,10 @@ x_get_window_property (Display *display, Window window, Atom property,
return;
size_overflow:
- free (data);
+ if (data)
+ xfree (data);
unblock_input ();
memory_full (SIZE_MAX);
-
- memory_exhausted:
- free (data);
- unblock_input ();
- memory_full (total_size + 1);
}
/* Use xfree, not XFree, to free the data obtained with this function. */