From 5690e7bcdc8f25eb253f01367bffe3c28cda13ad Mon Sep 17 00:00:00 2001
From: Juan Jose Garcia Ripoll <jjgarcia@users.sourceforge.net>
Date: Mon, 26 Apr 2010 14:49:14 +0200
Subject: [PATCH] In tests/misc-types.lisp, FOREIGN-FREE is used with pointers that were not allocated by CFFI

---
 tests/libtest.c       |    6 ++++++
 tests/misc-types.lisp |    8 +++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/tests/libtest.c b/tests/libtest.c
index e5161c9..215542b 100644
--- a/tests/libtest.c
+++ b/tests/libtest.c
@@ -72,6 +72,12 @@ char *my_strdup(const char *str)
 }
 
 DLLEXPORT
+void my_strfree(const char *str)
+{
+    free(str);
+}
+
+DLLEXPORT
 long long my_llabs(long long n)
 {
     return n < 0 ? -n : n;
diff --git a/tests/misc-types.lisp b/tests/misc-types.lisp
index 98cba7d..01c1b05 100644
--- a/tests/misc-types.lisp
+++ b/tests/misc-types.lisp
@@ -29,10 +29,12 @@
 
 (defcfun ("my_strdup" strdup) :string+ptr (str :string))
 
+(defcfun ("my_strfree" strfree) :void (str :pointer))
+
 (deftest misc-types.string+ptr
     (destructuring-bind (string pointer)
         (strdup "foo")
-      (foreign-free pointer)
+      (strfree pointer)
       string)
   "foo")
 
@@ -41,7 +43,7 @@
     (destructuring-bind (string pointer)
         (strdup (make-array 3 :element-type '(unsigned-byte 8)
                             :initial-contents (map 'list #'char-code "foo")))
-      (foreign-free pointer)
+      (strfree pointer)
       string)
   "foo")
 
@@ -124,7 +126,7 @@
 (deftest misc-types.wrapper
     (destructuring-bind (string ptr)
         (funky-strdup "code")
-      (foreign-free ptr)
+      (strfree ptr)
       string)
   "Strdup says: MORE CODE")
 
-- 
1.6.6.1

