diff options
Diffstat (limited to 'src/xselect.c')
| -rw-r--r-- | src/xselect.c | 16 |
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, | |||
| 1299 | if (total_size_max < bytes_remaining) | 1299 | if (total_size_max < bytes_remaining) |
| 1300 | goto size_overflow; | 1300 | goto size_overflow; |
| 1301 | total_size = bytes_remaining; | 1301 | total_size = bytes_remaining; |
| 1302 | data = malloc (total_size + 1); | 1302 | data = xmalloc (total_size + 1); |
| 1303 | if (! data) | ||
| 1304 | goto memory_exhausted; | ||
| 1305 | 1303 | ||
| 1306 | /* Now read, until we've gotten it all. */ | 1304 | /* Now read, until we've gotten it all. */ |
| 1307 | while (bytes_remaining) | 1305 | while (bytes_remaining) |
| @@ -1352,9 +1350,7 @@ x_get_window_property (Display *display, Window window, Atom property, | |||
| 1352 | if (remaining_lim < 0 || remaining_lim < bytes_remaining) | 1350 | if (remaining_lim < 0 || remaining_lim < bytes_remaining) |
| 1353 | goto size_overflow; | 1351 | goto size_overflow; |
| 1354 | total_size = offset + bytes_gotten + bytes_remaining; | 1352 | total_size = offset + bytes_gotten + bytes_remaining; |
| 1355 | data1 = realloc (data, total_size + 1); | 1353 | data1 = xrealloc (data, total_size + 1); |
| 1356 | if (! data1) | ||
| 1357 | goto memory_exhausted; | ||
| 1358 | data = data1; | 1354 | data = data1; |
| 1359 | } | 1355 | } |
| 1360 | 1356 | ||
| @@ -1386,14 +1382,10 @@ x_get_window_property (Display *display, Window window, Atom property, | |||
| 1386 | return; | 1382 | return; |
| 1387 | 1383 | ||
| 1388 | size_overflow: | 1384 | size_overflow: |
| 1389 | free (data); | 1385 | if (data) |
| 1386 | xfree (data); | ||
| 1390 | unblock_input (); | 1387 | unblock_input (); |
| 1391 | memory_full (SIZE_MAX); | 1388 | memory_full (SIZE_MAX); |
| 1392 | |||
| 1393 | memory_exhausted: | ||
| 1394 | free (data); | ||
| 1395 | unblock_input (); | ||
| 1396 | memory_full (total_size + 1); | ||
| 1397 | } | 1389 | } |
| 1398 | 1390 | ||
| 1399 | /* Use xfree, not XFree, to free the data obtained with this function. */ | 1391 | /* Use xfree, not XFree, to free the data obtained with this function. */ |