Skip to content

Commit b434301

Browse files
committed
memory leak fixed with old school
1 parent 05f2fc5 commit b434301

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ext/json/json.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,11 @@ PHP_FUNCTION(json_last_error_msg)
375375
{
376376
ZEND_PARSE_PARAMETERS_NONE();
377377

378-
RETURN_STRING(php_json_get_error_msg(JSON_G(error_code)));
378+
char *msg = php_json_get_error_msg(JSON_G(error_code));
379+
RETVAL_STRING(msg);
380+
if (JSON_G(error_code) == PHP_JSON_ERROR_SYNTAX) {
381+
efree(msg);
382+
}
383+
//original:RETURN_STRING(php_json_get_error_msg(JSON_G(error_code)));
379384
}
380385
/* }}} */

0 commit comments

Comments
 (0)