svn commit: samba r2601 - in branches/SAMBA_4_0/source/lib: .

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


Author: idra
Date: 2004-09-24 17:42:46 +0000 (Fri, 24 Sep 2004)
New Revision: 2601

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

Log:
avoid free()ing unallocated memory by mistake
Modified:
   branches/SAMBA_4_0/source/lib/xfile.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/xfile.c
===================================================================
--- branches/SAMBA_4_0/source/lib/xfile.c	2004-09-24 17:39:44 UTC (rev 2600)
+++ branches/SAMBA_4_0/source/lib/xfile.c	2004-09-24 17:42:46 UTC (rev 2601)
@@ -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