wez Mon Oct 14 21:57:19 2002 EDT
Modified files:
/php4/main user_streams.c
Log:
Fix leak, and avoid initialization problems where retval is re-used
within a function.
Index: php4/main/user_streams.c
diff -u php4/main/user_streams.c:1.27 php4/main/user_streams.c:1.28
--- php4/main/user_streams.c:1.27 Sun Oct 13 20:16:02 2002
+++ php4/main/user_streams.c Mon Oct 14 21:57:19 2002
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: user_streams.c,v 1.27 2002/10/14 00:16:02 wez Exp $ */
+/* $Id: user_streams.c,v 1.28 2002/10/15 01:57:19 wez Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -464,8 +464,10 @@
}
zval_ptr_dtor(&zcount);
- if (retval)
+ if (retval) {
zval_ptr_dtor(&retval);
+ retval = NULL;
+ }
/* since the user stream has no way of setting the eof flag directly, we need
to ask it if we hit eof */
@@ -487,6 +489,11 @@
stream->eof = 1;
}
+ if (retval) {
+ zval_ptr_dtor(&retval);
+ retval = NULL;
+ }
+
return didread;
}
@@ -586,8 +593,10 @@
ret = -1;
}
- if (retval)
+ if (retval) {
zval_ptr_dtor(&retval);
+ retval = NULL;
+ }
/* now determine where we are */
ZVAL_STRINGL(&func_name, USERSTREAM_TELL, sizeof(USERSTREAM_TELL)-1, 0);
@@ -603,10 +612,10 @@
else
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_TELL "
is not implemented!",
us->wrapper->classname);
-
+
if (retval)
zval_ptr_dtor(&retval);
-
+
return 0;
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php