[Forensics-changes] [yara] 171/415: Fix bug when trying to destroy an arena without being created
Hilko Bengen
bengen at moszumanska.debian.org
Thu Apr 3 05:43:01 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 97a7b1a357f4a9ecdf26dcebdfb1e46c8bf3f85f
Author: Victor M. Alvarez <plusvic at gmail.com>
Date: Fri May 31 09:42:36 2013 +0000
Fix bug when trying to destroy an arena without being created
---
libyara/compiler.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/libyara/compiler.c b/libyara/compiler.c
index 7389c81..4d5df21 100644
--- a/libyara/compiler.c
+++ b/libyara/compiler.c
@@ -443,20 +443,22 @@ int yr_compiler_get_rules(
YARA_RULES* yara_rules;
YARA_RULES_FILE_HEADER* rules_file_header;
- int result;
+ int result = ERROR_SUCCESS;
+
+ if (compiler->compiled_rules_arena == NULL)
+ result = _yr_compiler_compile_rules(compiler);
+
+ if (result != ERROR_SUCCESS)
+ return result;
yara_rules = yr_malloc(sizeof(YARA_RULES));
if (yara_rules == NULL)
return ERROR_INSUFICIENT_MEMORY;
- if (compiler->compiled_rules_arena == NULL)
- result = _yr_compiler_compile_rules(compiler);
-
- if (result == ERROR_SUCCESS)
- result = yr_arena_duplicate(
- compiler->compiled_rules_arena,
- &yara_rules->arena);
+ result = yr_arena_duplicate(
+ compiler->compiled_rules_arena,
+ &yara_rules->arena);
if (result == ERROR_SUCCESS)
{
@@ -473,9 +475,6 @@ int yr_compiler_get_rules(
}
else
{
- if (yara_rules->arena)
- yr_arena_destroy(yara_rules->arena);
-
yr_free(yara_rules);
*rules = NULL;
}
--
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