corinthia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g..@apache.org
Subject incubator-corinthia git commit: Add 'free()' loop to test_DFAddDirContents().
Date Mon, 06 Apr 2015 18:32:16 GMT
Repository: incubator-corinthia
Updated Branches:
  refs/heads/master ee6e8174c -> 7799c53ab


Add 'free()' loop to test_DFAddDirContents().

* DocFormats/platform/tests/OStests.c

  (test_DFAddDirContents): Add free() loop to remove the list
    generated.  Since the function freeDirEntryList(list) which is
    called by the production code is located in
    /incubator-corinthia/DocFormats/core/src/lib/DFFilesystem.c and
    the function tested is platform specific, it's simpler to just
    duplicate it's short functionality here to prevent a memory leak
    in the test suite.


Project: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/commit/7799c53a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/tree/7799c53a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/diff/7799c53a

Branch: refs/heads/master
Commit: 7799c53abdef9e0ca2fbd86b493ed50d459181cc
Parents: ee6e817
Author: Gabriela Gibson <gbg@apache.org>
Authored: Mon Apr 6 19:32:16 2015 +0100
Committer: Gabriela Gibson <gbg@apache.org>
Committed: Mon Apr 6 19:32:16 2015 +0100

----------------------------------------------------------------------
 DocFormats/platform/tests/OStests.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/7799c53a/DocFormats/platform/tests/OStests.c
----------------------------------------------------------------------
diff --git a/DocFormats/platform/tests/OStests.c b/DocFormats/platform/tests/OStests.c
index 27aafe4..9c32df7 100644
--- a/DocFormats/platform/tests/OStests.c
+++ b/DocFormats/platform/tests/OStests.c
@@ -175,11 +175,16 @@ static void test_DFAddDirContents(void)
     char            *errmsg;
     int              rc;
 
-
     rc = DFAddDirContents(".", "", 1, &listptr, &errmsg);
     utassert((rc == 1), "could not read dir");
-}
 
+    DFDirEntryList *next;
+    for (DFDirEntryList *l = list; l != NULL; l = next) {
+        next = l->next;
+        free(l->name);
+        free(l);
+    }
+}
 
 
 TestGroup PlatformOSTests = {


Mime
View raw message