From 5ca20a8748ed7fbede93896b556a1b54e4193273 Mon Sep 17 00:00:00 2001
From: jdh8d <jdh8d@git.zephyr-software.com>
Date: Tue, 19 May 2015 21:46:17 +0000
Subject: [PATCH] added delayed dealloc functionality

---
 watchsyscall/wa_callbacks.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/watchsyscall/wa_callbacks.c b/watchsyscall/wa_callbacks.c
index d200676..8fc53b6 100644
--- a/watchsyscall/wa_callbacks.c
+++ b/watchsyscall/wa_callbacks.c
@@ -245,9 +245,9 @@ int zipr_is_addr_ok(int ret, unsigned int to_check)
         {
                 page_no++;
 #ifdef DEBUG_ADD
-			print_str_debug("checking page=");
-			print_int_debug((int)page_no);
-			print_str_debug("\n");
+		print_str_debug("checking page=");
+		print_int_debug((int)page_no);
+		print_str_debug("\n");
 #endif
 		int i;
 		for(i=0;i<al->pairs;i++)
@@ -277,3 +277,19 @@ int zipr_is_addr_ok(int ret, unsigned int to_check)
 	cgc_terminate(199);
 	return 0;
 }
+
+
+int zipr_delayed_deallocate(unsigned int ret_pc, reg_values_t rv)
+{
+	void *addr=rv.ebx;
+	unsigned int length=rv.ecx;
+
+	static void* old_addr=0;
+	static unsigned int old_length=0;
+
+	cgc_deallocate(old_addr,old_length);
+
+	old_addr=addr;
+	old_length=length;
+	return 0;
+}
-- 
GitLab