You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2016/09/07 15:49:02 UTC

[5/7] lucy-clownfish git commit: Fix memory leaks in CFC tests

Fix memory leaks in CFC tests


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/ad5ba99c
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/ad5ba99c
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/ad5ba99c

Branch: refs/heads/master
Commit: ad5ba99cf66f8be6b9ca1a5db6db3b74c141abf3
Parents: c298a9e
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Sep 7 16:37:10 2016 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Wed Sep 7 17:22:44 2016 +0200

----------------------------------------------------------------------
 compiler/src/CFCTestHierarchy.c | 1 +
 compiler/src/CFCTestParcel.c    | 2 ++
 compiler/src/CFCUtil.c          | 4 +++-
 3 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ad5ba99c/compiler/src/CFCTestHierarchy.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCTestHierarchy.c b/compiler/src/CFCTestHierarchy.c
index 6fa1aae..1b1a568 100644
--- a/compiler/src/CFCTestHierarchy.c
+++ b/compiler/src/CFCTestHierarchy.c
@@ -323,6 +323,7 @@ S_run_clash_tests(CFCTest *test) {
     rmdir(AUTOGEN);
 
     FREEMEM(cfbase_path);
+    FREEMEM(cfinc_path);
     FREEMEM(cfclash_file_path);
     FREEMEM(cfclash_class_path);
     FREEMEM(cfclash_bar_path);

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ad5ba99c/compiler/src/CFCTestParcel.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCTestParcel.c b/compiler/src/CFCTestParcel.c
index 878ab02..5306182 100644
--- a/compiler/src/CFCTestParcel.c
+++ b/compiler/src/CFCTestParcel.c
@@ -165,6 +165,8 @@ S_run_basic_tests(CFCTest *test) {
     CFCBase_decref((CFCBase*)included_foo);
     CFCBase_decref((CFCBase*)file_spec);
     CFCBase_decref((CFCBase*)foo);
+    CFCBase_decref((CFCBase*)major);
+    CFCBase_decref((CFCBase*)version);
     CFCParcel_reap_singletons();
 }
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ad5ba99c/compiler/src/CFCUtil.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCUtil.c b/compiler/src/CFCUtil.c
index edc9c17..6c0f224 100644
--- a/compiler/src/CFCUtil.c
+++ b/compiler/src/CFCUtil.c
@@ -713,7 +713,9 @@ CFCUtil_rethrow(char *error) {
         longjmp(*current_env, 1);
     }
     else {
-        croak("%s", error);
+        SV *error_sv = newSVpv(error, 0);
+        free(error);
+        croak_sv(sv_2mortal(error_sv));
     }
 }