From 70ac6b6b55f0423eb9296fbdc7db0d2aa634a601 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 24 Sep 2004 17:38:23 +0000 Subject: r2599: avoid free()ing our static unalloceted memory that ends up in memory corruption. (This used to be commit 557e12d1b593b582ea1157d278bcdde6aba5a879) --- source3/lib/xfile.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source3/lib/xfile.c') diff --git a/source3/lib/xfile.c b/source3/lib/xfile.c index 1534dd855e..da5ec126c1 100644 --- a/source3/lib/xfile.c +++ b/source3/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; } -- cgit