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 2015/05/05 11:41:36 UTC
[9/9] lucy git commit: Address memory leaks in Freezer test
Address memory leaks in Freezer test
Not sure what's the best way to fix thawing of BoolNums.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/d460538f
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/d460538f
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/d460538f
Branch: refs/heads/master
Commit: d460538f26959f7bce097f5e9a11aa4616e2671f
Parents: 4e18b58
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Tue May 5 11:34:17 2015 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Tue May 5 11:34:17 2015 +0200
----------------------------------------------------------------------
core/Lucy/Test/Util/TestFreezer.c | 1 +
core/Lucy/Util/Freezer.c | 2 ++
2 files changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/d460538f/core/Lucy/Test/Util/TestFreezer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestFreezer.c b/core/Lucy/Test/Util/TestFreezer.c
index 7657a00..01fb687 100644
--- a/core/Lucy/Test/Util/TestFreezer.c
+++ b/core/Lucy/Test/Util/TestFreezer.c
@@ -95,6 +95,7 @@ test_hash(TestBatchRunner *runner) {
String *str = TestUtils_random_string(rand() % 1200);
Integer32 *num = Int32_new(i);
Hash_Store(wanted, str, (Obj*)num);
+ DECREF(str);
}
{
http://git-wip-us.apache.org/repos/asf/lucy/blob/d460538f/core/Lucy/Util/Freezer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Freezer.c b/core/Lucy/Util/Freezer.c
index 621d63c..9cc9410 100644
--- a/core/Lucy/Util/Freezer.c
+++ b/core/Lucy/Util/Freezer.c
@@ -142,6 +142,8 @@ Freezer_deserialize(Obj *obj, InStream *instream) {
if (Obj_Is_A(obj, BOOLNUM)) {
bool value = !!InStream_Read_U8(instream);
Obj *result = value ? INCREF(CFISH_TRUE) : INCREF(CFISH_FALSE);
+ // FIXME: This DECREF is essentially a no-op causing a
+ // memory leak.
DECREF(obj);
obj = result;
}