diff options
author | Simo Sorce <idra@samba.org> | 2004-09-24 17:38:23 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:52:47 -0500 |
commit | 557e12d1b593b582ea1157d278bcdde6aba5a879 (patch) | |
tree | aa4c19f7c826de151b274872ad350cce1d4148a5 /source/lib | |
parent | dcb577f1cd8cf60557c0d061afeec206f58a6b31 (diff) | |
download | samba-557e12d1b593b582ea1157d278bcdde6aba5a879.tar.gz samba-557e12d1b593b582ea1157d278bcdde6aba5a879.tar.xz samba-557e12d1b593b582ea1157d278bcdde6aba5a879.zip |
r2599: avoid free()ing our static unalloceted memory that ends up in memory corruption.
Diffstat (limited to 'source/lib')
-rw-r--r-- | source/lib/xfile.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/lib/xfile.c b/source/lib/xfile.c index 1534dd855e9..da5ec126c1f 100644 --- a/source/lib/xfile.c +++ b/source/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; } |