cvs: php4 /main streams.c
| From: | Wez Furlong | Date: | Tue, 15 Oct 2002 16:38:11 +0000 |
| Subject: | cvs: php4 /main streams.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-14943@lists.php.net to get a copy of this message | ||
wez Tue Oct 15 12:38:11 2002 EDT
Modified files:
/php4/main streams.c
Log:
Fix mem leak for zero-byte files.
Index: php4/main/streams.c
diff -u php4/main/streams.c:1.106 php4/main/streams.c:1.107
--- php4/main/streams.c:1.106 Tue Oct 15 12:04:46 2002
+++ php4/main/streams.c Tue Oct 15 12:38:11 2002
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streams.c,v 1.106 2002/10/15 16:04:46 wez Exp $ */
+/* $Id: streams.c,v 1.107 2002/10/15 16:38:11 wez Exp $ */
#define _GNU_SOURCE
#include "php.h"
@@ -1028,7 +1028,7 @@
#endif
srcfile = mmap(NULL, maxlen, PROT_READ, MAP_SHARED, srcfd, 0);
- if (srcfile != (void*)MAP_FAILED) {
+ if (srcfile != (void*)MAP_FAILED && ret > 0) {
*buf = pemalloc_rel_orig(maxlen + 1, persistent);