aboutsummaryrefslogtreecommitdiff
path: root/libXau
diff options
context:
space:
mode:
Diffstat (limited to 'libXau')
-rw-r--r--libXau/AuFileName.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libXau/AuFileName.c b/libXau/AuFileName.c
index 93335bc0f..e5ad5a372 100644
--- a/libXau/AuFileName.c
+++ b/libXau/AuFileName.c
@@ -69,12 +69,14 @@ XauFileName (void)
return NULL;
}
size = strlen (name) + strlen(&slashDotXauthority[1]) + 2;
- if (size > bsize) {
+ if ((size > bsize) || (buf == NULL)) {
if (buf)
free (buf);
buf = malloc (size);
- if (!buf)
+ if (!buf) {
+ bsize = 0;
return NULL;
+ }
if (!atexit_registered) {
atexit(free_filename_buffer);