summaryrefslogtreecommitdiff
path: root/source4/lib/xfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/xfile.c')
-rw-r--r--source4/lib/xfile.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source4/lib/xfile.c b/source4/lib/xfile.c
index de4cf4b12a..e01723904f 100644
--- a/source4/lib/xfile.c
+++ b/source4/lib/xfile.c
@@ -135,7 +135,12 @@ int x_fclose(XFILE *f)
memset(f->buf, 0, f->bufsize);
SAFE_FREE(f->buf);
}
- SAFE_FREE(f);
+ /* check the file descriptor given to the function is NOT one of the static
+ * descriptor of this libreary or we will free unallocated memory
+ * --sss */
+ if (f != x_stdin && f != x_stdout && f != x_stderr) {
+ SAFE_FREE(f);
+ }
return ret;
}