details: https://hg.nginx.org/njs/rev/88318e18dec9
branches:
changeset: 2211:88318e18dec9
user: Dmitry Volyntsev <xeioex@nginx.com>
date: Thu Sep 28 19:09:56 2023 -0700
description:
RegExp: improved memory footprint when match fails.
diffstat:
src/njs_regexp.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diffs (33 lines):
diff -r febba7cb31e0 -r 88318e18dec9 src/njs_regexp.c
--- a/src/njs_regexp.c Thu Sep 28 18:11:15 2023 -0700
+++ b/src/njs_regexp.c Thu Sep 28 19:09:56 2023 -0700
@@ -941,6 +941,9 @@ njs_regexp_builtin_exec(njs_vm_t *vm, nj
string.size, match_data);
if (ret >= 0) {
result = njs_regexp_exec_result(vm, r, utf8, &string, match_data);
+
+ njs_regex_match_data_free(match_data, vm->regex_generic_ctx);
+
if (njs_slow_path(result == NULL)) {
return NJS_ERROR;
}
@@ -949,8 +952,9 @@ njs_regexp_builtin_exec(njs_vm_t *vm, nj
return NJS_OK;
}
+ njs_regex_match_data_free(match_data, vm->regex_generic_ctx);
+
if (njs_slow_path(ret == NJS_ERROR)) {
- njs_regex_match_data_free(match_data, vm->regex_generic_ctx);
return NJS_ERROR;
}
@@ -1154,8 +1158,6 @@ fail:
done:
- njs_regex_match_data_free(match_data, vm->regex_generic_ctx);
-
return (ret == NJS_OK) ? array : NULL;
}
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel