[Forensics-changes] [yara] 321/368: Fix potential memory leak

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:30:53 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 aeae6aaa4a5bc8d75930e0faa3ae23abacb45b33
Author: plusvic <plusvic at gmail.com>
Date:   Wed Jun 15 14:18:36 2016 +0200

    Fix potential memory leak
    
    When ERROR_EXEC_STACK_OVERFLOW occurs "stack" is not released.
---
 libyara/exec.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/libyara/exec.c b/libyara/exec.c
index 6c57aef..55ba01e 100644
--- a/libyara/exec.c
+++ b/libyara/exec.c
@@ -49,10 +49,16 @@ typedef union _STACK_ITEM {
 
 
 #define push(x)  \
-    do { \
-      if (sp < stack_size) stack[sp++] = (x); \
-      else return ERROR_EXEC_STACK_OVERFLOW; \
-    } while(0)
+    if (sp < stack_size) \
+    { \
+      stack[sp++] = (x); \
+    } \
+    else \
+    { \
+      result = ERROR_EXEC_STACK_OVERFLOW; \
+      stop = TRUE; \
+      break; \
+    } \
 
 
 #define pop(x)  x = stack[--sp]

-- 
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