[Forensics-changes] [yara] 70/368: Avoid incrementing init_count when yr_initialize fails

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:30:12 UTC 2017


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag v3.5.0
in repository yara.

commit 56111a2bc79b0cade629e159b48aaaba51c1be12
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Wed Sep 23 14:55:13 2015 +0200

    Avoid incrementing init_count when yr_initialize fails
---
 libyara/libyara.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libyara/libyara.c b/libyara/libyara.c
index 96c2897..5b2b024 100644
--- a/libyara/libyara.c
+++ b/libyara/libyara.c
@@ -54,10 +54,11 @@ YR_API int yr_initialize(void)
 {
   int i;
 
-  init_count++;
-
-  if (init_count > 1)
+  if (init_count > 0)
+  {
+    init_count++;
     return ERROR_SUCCESS;
+  }
 
   for (i = 0; i < 256; i++)
   {
@@ -84,6 +85,8 @@ YR_API int yr_initialize(void)
   FAIL_ON_ERROR(yr_re_initialize());
   FAIL_ON_ERROR(yr_modules_initialize());
 
+  init_count++;
+
   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