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 090427387..7cedfcc5b 100644
--- a/libXau/AuFileName.c
+++ b/libXau/AuFileName.c
@@ -66,12 +66,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);