com php-src: Fix leak: ext/pdo/pdo_stmt.c
| From: | Nikita Popov | Date: | Fri, 18 Dec 2020 20:48:21 +0000 |
| Subject: | com php-src: Fix leak: ext/pdo/pdo_stmt.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-114509@lists.php.net to get a copy of this message | ||
Commit: c7cccc1c9a2e6bf41dc82a80e0772b52c70b06f0
Author: Nikita Popov <nikita.ppv@gmail.com> Fri, 18 Dec 2020 21:48:21 +0100
Parents: 7904a087ec4fc156c52e0f5e8e15d798808f7843
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c7cccc1c9a2e6bf41dc82a80e0772b52c70b06f0
Log:
Fix leak
Changed paths:
M ext/pdo/pdo_stmt.c
Diff:
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index e9103425822..7ea0f6df0fc 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -569,13 +569,14 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int
*typ
}
} else if (!stmt->dbh->stringify && new_type != PDO_PARAM_STR) {
/* they gave us a string, but LOBs are represented as streams in PDO */
- php_stream *stm = php_stream_memory_open(TEMP_STREAM_READONLY,
- zend_string_init(value, value_len, 0));
- if (stm) {
- php_stream_to_zval(stm, dest);
+ zend_string *str = zend_string_init(value, value_len, 0);
+ php_stream *stream = php_stream_memory_open(TEMP_STREAM_READONLY, str);
+ if (stream) {
+ php_stream_to_zval(stream, dest);
} else {
ZVAL_NULL(dest);
}
+ zend_string_release(str);
} else {
ZVAL_STRINGL(dest, value, value_len);
}