aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2014-09-16 21:34:37 +0000
committerEvan Huus <eapache@gmail.com>2014-09-20 18:09:28 +0000
commit2154e2346ed6dcbf5c7e270dbcc0f4a9a727b7a0 (patch)
treefcbcfaf0fd7850aed9102e89904e971631c6e5b6
parent3c5541906b71736ecfcc6d89b31195d7c8e5d383 (diff)
ssl: allocate regexes with glib
they're stored in a static variable so we only ever need compile them once and they can just hang around forever Change-Id: Icf43745ad80f4984443a67af21c979625363fc6f Ping-Bug: 10474 Reviewed-on: https://code.wireshark.org/review/4139 Reviewed-by: Evan Huus <eapache@gmail.com>
-rw-r--r--epan/dissectors/packet-ssl-utils.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/epan/dissectors/packet-ssl-utils.c b/epan/dissectors/packet-ssl-utils.c
index fd5cbb9154..ff2efe34b8 100644
--- a/epan/dissectors/packet-ssl-utils.c
+++ b/epan/dissectors/packet-ssl-utils.c
@@ -4473,8 +4473,7 @@ ssl_compile_keyfile_regexes(GRegex ***regexes_out)
GError *gerr = NULL;
if (!regexes) {
- regexes = (GRegex**) wmem_alloc(wmem_file_scope(),
- array_length(patterns) * sizeof(GRegex *));
+ regexes = (GRegex**) g_malloc(array_length(patterns) * sizeof(GRegex *));
for (i = 0; i < array_length(patterns); i++) {
regexes[i] = g_regex_new(patterns[i], G_REGEX_OPTIMIZE,
G_REGEX_MATCH_ANCHORED, &gerr);
@@ -4485,6 +4484,8 @@ ssl_compile_keyfile_regexes(GRegex ***regexes_out)
/* failed to compile some regexes, free resources and fail */
while (i-- > 0)
g_regex_unref(regexes[i]);
+ g_free(regexes);
+ regexes = NULL;
return 0;
}
}