This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch master in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=e93d0e5d70fa36aa307a6ecaed433b8377c037bf commit e93d0e5d70fa36aa307a6ecaed433b8377c037bf Author: Guillem Jover <[email protected]> AuthorDate: Sun Aug 16 22:54:39 2020 +0200 test: Fix short lived memory leaks in unit tests These are inconsequential, but shadow actual memory leaks from being detected by address sanitizers or similar tools. Warned-by: gcc ASAN --- lib/dpkg/t/c-tarextract.c | 2 ++ lib/dpkg/t/t-arch.c | 2 ++ lib/dpkg/t/t-buffer.c | 2 ++ lib/dpkg/t/t-command.c | 2 ++ lib/dpkg/t/t-file.c | 2 ++ 5 files changed, 10 insertions(+) diff --git a/lib/dpkg/t/c-tarextract.c b/lib/dpkg/t/c-tarextract.c index a2cd6972a..461f77f4a 100644 --- a/lib/dpkg/t/c-tarextract.c +++ b/lib/dpkg/t/c-tarextract.c @@ -140,6 +140,8 @@ main(int argc, char **argv) if (tar_extractor(&tar)) ohshite("extracting tar"); + dpkg_error_destroy(&tar.err); + if (tar_name) close(tar_ctx.tar_fd); diff --git a/lib/dpkg/t/t-arch.c b/lib/dpkg/t/t-arch.c index 55c6ea32a..430980ee3 100644 --- a/lib/dpkg/t/t-arch.c +++ b/lib/dpkg/t/t-arch.c @@ -186,6 +186,8 @@ test_dpkg_arch_varbuf_archqual(void) varbuf_end_str(&vb); test_str(vb.buf, ==, ":any"); varbuf_reset(&vb); + + varbuf_destroy(&vb); } static void diff --git a/lib/dpkg/t/t-buffer.c b/lib/dpkg/t/t-buffer.c index 2847e9373..fa939e55d 100644 --- a/lib/dpkg/t/t-buffer.c +++ b/lib/dpkg/t/t-buffer.c @@ -69,6 +69,8 @@ test_fdio_hash(void) test_str(hash, ==, ref_hash_test); test_pass(unlink(test_file) == 0); + + free(test_file); } TEST_ENTRY(test) diff --git a/lib/dpkg/t/t-command.c b/lib/dpkg/t/t-command.c index 099884560..4c360064c 100644 --- a/lib/dpkg/t/t-command.c +++ b/lib/dpkg/t/t-command.c @@ -180,6 +180,8 @@ test_command_exec(void) ret = subproc_reap(pid, "command exec test", 0); test_pass(ret == 0); + + command_destroy(&cmd); } static void diff --git a/lib/dpkg/t/t-file.c b/lib/dpkg/t/t-file.c index ca68eaefe..278df9141 100644 --- a/lib/dpkg/t/t-file.c +++ b/lib/dpkg/t/t-file.c @@ -63,6 +63,7 @@ test_file_slurp(void) test_error(err); varbuf_destroy(&vb); test_pass(rmdir(test_dir) == 0); + free(test_dir); test_file = test_alloc(strdup("test.XXXXXX")); fd = mkstemp(test_file); @@ -86,6 +87,7 @@ test_file_slurp(void) varbuf_destroy(&vb); test_pass(unlink(test_file) == 0); + free(test_file); } TEST_ENTRY(test) -- Dpkg.Org's dpkg

