Skip to content

Commit c7cccc1

Browse files
committed
Fix leak
1 parent 7904a08 commit c7cccc1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ext/pdo/pdo_stmt.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -569,13 +569,14 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ
569569
}
570570
} else if (!stmt->dbh->stringify && new_type != PDO_PARAM_STR) {
571571
/* they gave us a string, but LOBs are represented as streams in PDO */
572-
php_stream *stm = php_stream_memory_open(TEMP_STREAM_READONLY,
573-
zend_string_init(value, value_len, 0));
574-
if (stm) {
575-
php_stream_to_zval(stm, dest);
572+
zend_string *str = zend_string_init(value, value_len, 0);
573+
php_stream *stream = php_stream_memory_open(TEMP_STREAM_READONLY, str);
574+
if (stream) {
575+
php_stream_to_zval(stream, dest);
576576
} else {
577577
ZVAL_NULL(dest);
578578
}
579+
zend_string_release(str);
579580
} else {
580581
ZVAL_STRINGL(dest, value, value_len);
581582
}

0 commit comments

Comments
 (0)