Skip to content

Commit f39c07a

Browse files
committed
DOM/XPath: Use RETURN_NEW_STR
These strings are newly allocated and can't be interned, so we can use RETURN_NEW_STR.
1 parent 35e96f6 commit f39c07a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ext/dom/xpath.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -499,14 +499,14 @@ PHP_METHOD(DOMXPath, quote) {
499499
memcpy(ZSTR_VAL(output) + 1, input, input_len);
500500
ZSTR_VAL(output)[input_len + 1] = '\'';
501501
ZSTR_VAL(output)[input_len + 2] = '\0';
502-
RETURN_STR(output);
502+
RETURN_NEW_STR(output);
503503
} else if (memchr(input, '"', input_len) == NULL) {
504504
zend_string *const output = zend_string_safe_alloc(1, input_len, 2, false);
505505
ZSTR_VAL(output)[0] = '"';
506506
memcpy(ZSTR_VAL(output) + 1, input, input_len);
507507
ZSTR_VAL(output)[input_len + 1] = '"';
508508
ZSTR_VAL(output)[input_len + 2] = '\0';
509-
RETURN_STR(output);
509+
RETURN_NEW_STR(output);
510510
} else {
511511
smart_str output = {0};
512512
// need to use the concat() trick published by Robert Rossney at https://stackoverflow.com/a/1352556/1067003
@@ -528,7 +528,7 @@ PHP_METHOD(DOMXPath, quote) {
528528
}
529529
ZEND_ASSERT(ptr == end);
530530
ZSTR_VAL(output.s)[ZSTR_LEN(output.s) - 1] = ')';
531-
RETURN_STR(smart_str_extract(&output));
531+
RETURN_NEW_STR(smart_str_extract(&output));
532532
}
533533
}
534534
/* }}} */

0 commit comments

Comments
 (0)