cvs: php4 /main memory_streams.c
| From: | Marcus B�rger | Date: | Thu, 21 Mar 2002 20:37:05 +0000 |
| Subject: | cvs: php4 /main memory_streams.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-10551@lists.php.net to get a copy of this message | ||
helly Thu Mar 21 15:37:05 2002 EDT
Modified files:
/php4/main memory_streams.c
Log:
-missing efree in close
Index: php4/main/memory_streams.c
diff -u php4/main/memory_streams.c:1.12 php4/main/memory_streams.c:1.13
--- php4/main/memory_streams.c:1.12 Thu Mar 21 07:55:37 2002
+++ php4/main/memory_streams.c Thu Mar 21 15:37:04 2002
@@ -82,7 +82,7 @@
/* {{{ */
static size_t php_stream_memory_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
-{
+{
php_stream_memory_data *ms;
assert(stream != NULL);
@@ -113,7 +113,7 @@
/* {{{ */
static int php_stream_memory_close(php_stream *stream, int close_handle TSRMLS_DC)
-{
+{
php_stream_memory_data *ms;
assert(stream != NULL);
@@ -123,16 +123,14 @@
if (ms->data) {
efree(ms->data);
}
- ms->data = NULL;
- ms->fsize = 0;
- ms->fpos = 0;
+ efree(ms);
return 0;
}
/* }}} */
/* {{{ */
-static int php_stream_memory_flush(php_stream *stream TSRMLS_DC) {
+static int php_stream_memory_flush(php_stream *stream TSRMLS_DC) {
/* nothing to do here */
return 0;
}
@@ -225,7 +223,7 @@
/* {{{ */
static int php_stream_memory_cast(php_stream *stream, int castas, void **ret TSRMLS_DC)
-{
+{
return FAILURE;
}
/* }}} */
@@ -278,7 +276,7 @@
/* {{{ */
PHPAPI char *_php_stream_memory_get_buffer(php_stream *stream, size_t *length STREAMS_DC TSRMLS_DC)
-{
+{
php_stream_memory_data *ms;
assert(stream != NULL);
@@ -304,7 +302,7 @@
/* {{{ */
static size_t php_stream_temp_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
-{
+{
php_stream_temp_data *ts;
assert(stream != NULL);
@@ -329,7 +327,7 @@
/* {{{ */
static size_t php_stream_temp_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
-{
+{
php_stream_temp_data *ts;
assert(stream != NULL);
@@ -354,7 +352,7 @@
ret = php_stream_free(ts->innerstream, PHP_STREAM_FREE_CLOSE | (close_handle ? 0 :
PHP_STREAM_FREE_PRESERVE_HANDLE));
efree(ts);
-
+
return ret;
}
/* }}} */
@@ -362,7 +360,7 @@
/* {{{ */
static int php_stream_temp_flush(php_stream *stream TSRMLS_DC)
-{
+{
php_stream_temp_data *ts;
assert(stream != NULL);
@@ -376,7 +374,7 @@
/* {{{ */
static int php_stream_temp_seek(php_stream *stream, off_t offset, int whence TSRMLS_DC)
-{
+{
php_stream_temp_data *ts;
assert(stream != NULL);
@@ -390,7 +388,7 @@
/* {{{ */
char *php_stream_temp_gets(php_stream *stream, char *buf, size_t maxlen TSRMLS_DC)
-{
+{
php_stream_temp_data *ts;
assert(stream != NULL);
@@ -404,7 +402,7 @@
/* {{{ */
static int php_stream_temp_cast(php_stream *stream, int castas, void **ret TSRMLS_DC)
-{
+{
php_stream_temp_data *ts;
php_stream *file;
size_t memsize;
@@ -432,17 +430,17 @@
if (ret == NULL) {
return FAILURE;
}
-
+
/* perform the conversion and then pass the request on to the innerstream */
membuf = php_stream_memory_get_buffer(ts->innerstream, &memsize);
file = php_stream_fopen_tmpfile();
php_stream_write(file, membuf, memsize);
pos = php_stream_tell(ts->innerstream);
-
+
php_stream_close(ts->innerstream);
ts->innerstream = file;
php_stream_seek(ts->innerstream, pos, SEEK_SET);
-
+
return php_stream_cast(ts->innerstream, castas, ret, 1);
}
/* }}} */
@@ -459,7 +457,7 @@
/* {{{ */
PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STREAMS_DC TSRMLS_DC)
-{
+{
php_stream_temp_data *self;
php_stream *stream;
@@ -477,7 +475,7 @@
/* {{{ */
PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char *buf, size_t
length STREAMS_DC TSRMLS_DC)
-{
+{
php_stream *stream;
php_stream_temp_data *ms;