diff -Nru yara-3.10.0/debian/changelog yara-3.10.0/debian/changelog --- yara-3.10.0/debian/changelog 2019-05-03 07:51:22.000000000 +0000 +++ yara-3.10.0/debian/changelog 2019-06-06 20:05:30.000000000 +0000 @@ -1,3 +1,9 @@ +yara (3.10.0-2) unstable; urgency=medium + + * Add fix for memory leak (upstream issue 1070) + + -- Hilko Bengen Thu, 06 Jun 2019 22:05:30 +0200 + yara (3.10.0-1) unstable; urgency=medium * New upstream version 3.10.0 diff -Nru yara-3.10.0/debian/patches/fix-memory-leak-issue-1070.patch yara-3.10.0/debian/patches/fix-memory-leak-issue-1070.patch --- yara-3.10.0/debian/patches/fix-memory-leak-issue-1070.patch 1970-01-01 00:00:00.000000000 +0000 +++ yara-3.10.0/debian/patches/fix-memory-leak-issue-1070.patch 2019-06-06 20:05:30.000000000 +0000 @@ -0,0 +1,26 @@ +From: "Victor M. Alvarez" +Date: Wed, 5 Jun 2019 23:07:09 +0200 +Subject: Fix memory leak when _yr_process_attach fails. + +Closes #1070. +--- + libyara/proc.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/libyara/proc.c b/libyara/proc.c +index 23b4468..10518d0 100644 +--- a/libyara/proc.c ++++ b/libyara/proc.c +@@ -56,7 +56,11 @@ YR_API int yr_process_open_iterator( + context->current_block.fetch_data = yr_process_fetch_memory_block_data; + context->proc_info = NULL; + +- return _yr_process_attach(pid, context); ++ FAIL_ON_ERROR_WITH_CLEANUP( ++ _yr_process_attach(pid, context), ++ yr_free(context)); ++ ++ return ERROR_SUCCESS; + } + + diff -Nru yara-3.10.0/debian/patches/no-unaligned-access.patch yara-3.10.0/debian/patches/no-unaligned-access.patch --- yara-3.10.0/debian/patches/no-unaligned-access.patch 2019-05-03 07:50:08.000000000 +0000 +++ yara-3.10.0/debian/patches/no-unaligned-access.patch 2019-06-06 20:05:30.000000000 +0000 @@ -14,7 +14,7 @@ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/libyara/exec.c b/libyara/exec.c -index 9f0ba8f..56f39c3 100644 +index a5d598f..a11daf1 100644 --- a/libyara/exec.c +++ b/libyara/exec.c @@ -266,7 +266,7 @@ int yr_execute_code( @@ -71,7 +71,7 @@ ip += sizeof(uint64_t); #if PARANOID_EXEC ensure_within_mem(r1.i); -@@ -325,7 +325,7 @@ int yr_execute_code( +@@ -337,7 +337,7 @@ int yr_execute_code( break; case OP_SWAPUNDEF: @@ -80,7 +80,7 @@ ip += sizeof(uint64_t); #if PARANOID_EXEC ensure_within_mem(r1.i); -@@ -956,7 +956,7 @@ int yr_execute_code( +@@ -998,7 +998,7 @@ int yr_execute_code( break; case OP_IMPORT: @@ -89,7 +89,7 @@ ip += sizeof(uint64_t); result = yr_modules_load((char*) r1.p, context); -@@ -1000,8 +1000,7 @@ int yr_execute_code( +@@ -1042,8 +1042,7 @@ int yr_execute_code( break; case OP_INT_TO_DBL: diff -Nru yara-3.10.0/debian/patches/series yara-3.10.0/debian/patches/series --- yara-3.10.0/debian/patches/series 2019-05-03 07:50:08.000000000 +0000 +++ yara-3.10.0/debian/patches/series 2019-06-06 20:05:30.000000000 +0000 @@ -1 +1,2 @@ no-unaligned-access.patch +fix-memory-leak-issue-1070.patch