[Forensics-changes] [yara] 37/160: Fix memory leaks found using pe module.

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:29:15 UTC 2017


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

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

commit bc9d5b6045e036fbe4a06eb54ca50c18ad3b7502
Author: Shane Huntley <shuntley at google.com>
Date:   Wed Mar 11 20:09:52 2015 -0700

    Fix memory leaks found using pe module.
---
 libyara/modules/pe.c | 6 ++++++
 libyara/object.c     | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/libyara/modules/pe.c b/libyara/modules/pe.c
index cf95677..a9edd9d 100644
--- a/libyara/modules/pe.c
+++ b/libyara/modules/pe.c
@@ -321,6 +321,8 @@ void pe_parse_rich_signature(
     set_sized_string(
         (char*) clear_data, rich_len, pe->object, "rich_signature.clear_data");
 
+    yr_free(raw_data);
+    yr_free(clear_data);
     return;
   }
 
@@ -2107,10 +2109,14 @@ int module_unload(YR_OBJECT* module_object)
 
   while (dll)
   {
+    if (dll->name)
+      yr_free(dll->name);
     func = dll->functions;
 
     while (func)
     {
+      if (func->name)
+        yr_free(func->name);
       next_func = func->next;
       yr_free(func);
       func = next_func;
diff --git a/libyara/object.c b/libyara/object.c
index d4586c9..ef84d2a 100644
--- a/libyara/object.c
+++ b/libyara/object.c
@@ -344,7 +344,7 @@ void yr_object_destroy(
 
     case OBJECT_TYPE_ARRAY:
       if (((YR_OBJECT_ARRAY*) object)->prototype_item != NULL)
-        yr_free(((YR_OBJECT_ARRAY*) object)->prototype_item);
+        yr_object_destroy(((YR_OBJECT_ARRAY*) object)->prototype_item);
 
       array_items = ((YR_OBJECT_ARRAY*) object)->items;
 
@@ -360,7 +360,7 @@ void yr_object_destroy(
 
     case OBJECT_TYPE_DICTIONARY:
       if (((YR_OBJECT_DICTIONARY*) object)->prototype_item != NULL)
-        yr_free(((YR_OBJECT_DICTIONARY*) object)->prototype_item);
+        yr_object_destroy(((YR_OBJECT_DICTIONARY*) object)->prototype_item);
 
       dict_items = ((YR_OBJECT_DICTIONARY*) object)->items;
 

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