diff options
author | Joseph Hunkeler <jhunkeler@users.noreply.github.com> | 2025-02-04 13:06:11 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-04 13:06:11 -0500 |
commit | 89bd28eb5ac263d1753021f25e1bc62f48e7008d (patch) | |
tree | 622918f9a81723b830ab8bcc403154271932b591 /tests/test_utils.c | |
parent | 2372e40c40ef7bc85176d8998272ad75a59fcf05 (diff) | |
parent | 825aa472739775a5e2d673043f9d846df1eac924 (diff) | |
download | stasis-89bd28eb5ac263d1753021f25e1bc62f48e7008d.tar.gz |
Merge pull request #86 from jhunkeler/memfixes
ASAN: Fix leaks
Diffstat (limited to 'tests/test_utils.c')
-rw-r--r-- | tests/test_utils.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/test_utils.c b/tests/test_utils.c index 9090b05..8f0a667 100644 --- a/tests/test_utils.c +++ b/tests/test_utils.c @@ -46,6 +46,7 @@ void test_redact_sensitive() { char output[100] = {0}; redact_sensitive(to_redact, sizeof(to_redact) / sizeof(*to_redact), input, output, sizeof(output) - 1); STASIS_ASSERT(strcmp(output, expected[i]) == 0, "incorrect redaction"); + guard_free(input); } } @@ -118,6 +119,7 @@ void test_path_store() { STASIS_ASSERT(dest != NULL, "dest should not be NULL"); STASIS_ASSERT(dest && (access(dest, F_OK) == 0), "destination path was not created"); rmtree(dest); + guard_free(dest); } void test_isempty_dir() { @@ -226,6 +228,7 @@ void test_git_clone_and_describe() { char *taginfo_bad = git_describe("abc1234_not_here_or_there"); STASIS_ASSERT(taginfo_bad == NULL, "a repository that shouldn't exist... exists and has a tag."); chdir(cwd); + guard_free(cwd); } void test_touch() { @@ -414,9 +417,11 @@ void test_pushd_popd() { // we should be inside the test directory, not the starting directory STASIS_ASSERT(strcmp(cwd_workspace, cwd) != 0, ""); STASIS_ASSERT(popd() == 0, "return from directory failed"); + guard_free(cwd); char *cwd_after_popd = getcwd(NULL, PATH_MAX); STASIS_ASSERT(strcmp(cwd_workspace, cwd_after_popd) == 0, "should be the path where we started"); + guard_free(cwd_after_popd); } void test_pushd_popd_suggested_workflow() { @@ -436,6 +441,7 @@ void test_pushd_popd_suggested_workflow() { // cwd should be our starting directory char *cwd = getcwd(NULL, PATH_MAX); STASIS_ASSERT(strcmp(cwd_workspace, cwd) == 0, NULL); + guard_free(cwd); } else { STASIS_ASSERT(false, "mkdir function failed"); } |