svn commit: samba r2599 - in branches/SAMBA_3_0/source/lib: .

idra at samba.org idra at samba.org
Fri Sep 24 17:38:24 GMT 2004


Author: idra
Date: 2004-09-24 17:38:23 +0000 (Fri, 24 Sep 2004)
New Revision: 2599

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_3_0/source/lib&rev=2599&nolog=1

Log:

avoid free()ing our static unalloceted memory that ends up in memory corruption.


Modified:
   branches/SAMBA_3_0/source/lib/xfile.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/xfile.c
===================================================================
--- branches/SAMBA_3_0/source/lib/xfile.c	2004-09-24 13:06:21 UTC (rev 2598)
+++ branches/SAMBA_3_0/source/lib/xfile.c	2004-09-24 17:38:23 UTC (rev 2599)
@@ -135,7 +135,12 @@
 		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;
 }
 



More information about the samba-cvs mailing list