[Forensics-changes] [yara] 241/415: Free regexp engine stacks when finalizing the thread
Hilko Bengen
bengen at moszumanska.debian.org
Thu Apr 3 05:43:10 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to branch debian
in repository yara.
commit 871dfe770cb2ddc0ba5b0f23d4504eb673df2c21
Author: Victor M. Alvarez <plusvic at gmail.com>
Date: Fri Nov 22 15:46:06 2013 +0000
Free regexp engine stacks when finalizing the thread
---
libyara/re.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/libyara/re.c b/libyara/re.c
index b243e54..713a862 100644
--- a/libyara/re.c
+++ b/libyara/re.c
@@ -168,16 +168,29 @@ int yr_re_finalize()
int yr_re_finalize_thread()
{
- RE_THREAD_STORAGE* thread_storage;
+ RE_STACK* stack;
+ RE_STACK* next_stack;
+ RE_THREAD_STORAGE* storage;
#ifdef WIN32
- thread_storage = TlsGetValue(thread_storage_key);
+ storage = TlsGetValue(thread_storage_key);
#else
- thread_storage = pthread_getspecific(thread_storage_key);
+ storage = pthread_getspecific(thread_storage_key);
#endif
- if (thread_storage != NULL)
- yr_free(thread_storage);
+ if (storage != NULL)
+ {
+ stack = storage->stack_pool.free;
+
+ while (stack != NULL)
+ {
+ next_stack = stack->next;
+ yr_free(stack);
+ stack = next_stack;
+ }
+
+ yr_free(storage);
+ }
return ERROR_SUCCESS;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git
More information about the forensics-changes
mailing list