summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/lib/xfile.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source3/lib/xfile.c b/source3/lib/xfile.c
index 8a6776b5f9..503e8c8359 100644
--- a/source3/lib/xfile.c
+++ b/source3/lib/xfile.c
@@ -267,7 +267,9 @@ int x_fflush(XFILE *f)
f->bufused -= ret;
if (f->bufused > 0) {
f->flags |= X_FLAG_ERROR;
- memmove(f->buf, ret + (char *)f->buf, f->bufused);
+ if (f->buf) {
+ memmove(f->buf, ret + (char *)f->buf, f->bufused);
+ }
return -1;
}