Skip to content

Commit 7e61e6c

Browse files
committed
Fix leaks
1 parent 7ed0a4d commit 7e61e6c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Zend/zend_execute.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,7 +1640,7 @@ static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim,
16401640
memset(Z_STRVAL_P(str) + old_len, ' ', offset - old_len);
16411641
memcpy(Z_STRVAL_P(str) + offset, string_value, string_len);
16421642
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
1643-
ZVAL_INTERNED_STR(EX_VAR(opline->result.var), zend_string_init(Z_STRVAL_P(str), Z_STRLEN_P(str), 0));
1643+
ZVAL_STR(EX_VAR(opline->result.var), zend_string_init(Z_STRVAL_P(str), Z_STRLEN_P(str), 0));
16441644
}
16451645
return;
16461646
} else if (!Z_REFCOUNTED_P(str)) {
@@ -1656,7 +1656,7 @@ static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim,
16561656
int k = 0;
16571657
// Source offset
16581658
int i = 0;
1659-
char *buffer = emalloc(Z_STRLEN_P(str) + string_len - 1); // -1 as we replace a byte
1659+
char *buffer = emalloc(Z_STRLEN_P(str) + string_len);
16601660
char *source = Z_STRVAL_P(str);
16611661
// Append bytes from the source string to the buffer until the offset is reached
16621662
while (i < offset) {
@@ -1684,7 +1684,7 @@ static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim,
16841684
buffer[k] = '\0';
16851685
ZVAL_NEW_STR(str, zend_string_init(buffer, Z_STRLEN_P(str) + string_len - 1, 0));
16861686
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
1687-
ZVAL_INTERNED_STR(EX_VAR(opline->result.var), zend_string_init(Z_STRVAL_P(str), Z_STRLEN_P(str), 0));
1687+
ZVAL_STR(EX_VAR(opline->result.var), zend_string_init(Z_STRVAL_P(str), Z_STRLEN_P(str), 0));
16881688
}
16891689

16901690
efree(buffer);

0 commit comments

Comments
 (0)