diff options
author | David Tardon <dtardon@redhat.com> | 2023-03-28 09:38:33 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2023-04-12 17:09:41 +0200 |
commit | 1abcc826ca0330d4f1e407fad4a71d2f6c537a53 (patch) | |
tree | 00856d003f3deb680c263af303da0d63fa8729d9 /src/test/test-install.c | |
parent | 6ff02eac416212300b2afe74d3757805b830ece9 (diff) | |
download | systemd-1abcc826ca0330d4f1e407fad4a71d2f6c537a53.tar.gz |
test: use _cleanup_ for UnitFileList hash
Diffstat (limited to 'src/test/test-install.c')
-rw-r--r-- | src/test/test-install.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/test/test-install.c b/src/test/test-install.c index eb02795096..9fba0a8ca8 100644 --- a/src/test/test-install.c +++ b/src/test/test-install.c @@ -20,7 +20,7 @@ static void dump_changes(InstallChange *c, unsigned n) { } int main(int argc, char* argv[]) { - Hashmap *h; + _cleanup_(hashmap_freep) Hashmap *h = NULL; UnitFileList *p; int r; const char *const files[] = { "avahi-daemon.service", NULL }; @@ -31,7 +31,7 @@ int main(int argc, char* argv[]) { test_setup_logging(LOG_DEBUG); - h = hashmap_new(&string_hash_ops); + h = hashmap_new(&unit_file_list_hash_ops_free); r = unit_file_get_list(RUNTIME_SCOPE_SYSTEM, NULL, h, NULL, NULL); assert_se(r == 0); @@ -48,8 +48,6 @@ int main(int argc, char* argv[]) { unit_file_state_to_string(p->state)); } - unit_file_list_free(h); - log_info("/*** enable **/"); r = unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes); |