]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Use hashmap_free_free where appropriate
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 28 Nov 2017 11:31:27 +0000 (12:31 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 28 Nov 2017 20:26:37 +0000 (21:26 +0100)
src/journal/sd-journal.c
src/test/test-mount-util.c

index 0b6698782da60d144d126b3f6fae65410878e3e0..59ddc73e88b0ad299601373689913d08f904eeb0 100644 (file)
@@ -1978,7 +1978,6 @@ fail:
 _public_ void sd_journal_close(sd_journal *j) {
         Directory *d;
         JournalFile *f;
-        char *p;
 
         if (!j)
                 return;
@@ -2006,9 +2005,7 @@ _public_ void sd_journal_close(sd_journal *j) {
                 mmap_cache_unref(j->mmap);
         }
 
-        while ((p = hashmap_steal_first(j->errors)))
-                free(p);
-        hashmap_free(j->errors);
+        hashmap_free_free(j->errors);
 
         free(j->path);
         free(j->prefix);
index 9582d6ceecf069785ed076acf80b4ad952d7596b..2aad7f387c698614aacbd3b2bbb9bb56f9ca14a6 100644 (file)
@@ -97,10 +97,7 @@ static void test_mnt_id(void) {
                 assert_se(path_equal_ptr(hashmap_get(h, INT_TO_PTR(mnt_id2)), p));
         }
 
-        while ((p = hashmap_steal_first(h)))
-                free(p);
-
-        hashmap_free(h);
+        hashmap_free_free(h);
 }
 
 int main(int argc, char *argv[]) {