]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: improve hooks de-initialization
authorKarel Zak <kzak@redhat.com>
Thu, 20 Apr 2023 08:39:20 +0000 (10:39 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 20 Apr 2023 08:39:20 +0000 (10:39 +0200)
Don't cleanup if all related to the hooks is already empty.

Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/hooks.c

index c8d45d47915842ca17ea94d5f7d8554e1e81c318..88cf68d611104d2fa07ba32befc098f813bcb70e 100644 (file)
@@ -100,6 +100,10 @@ int mnt_context_deinit_hooksets(struct libmnt_context *cxt)
 
        assert(cxt);
 
+       if (list_empty(&cxt->hooksets_datas) &&
+           list_empty(&cxt->hooksets_hooks))
+               return 0;
+
        for (i = 0; i <  ARRAY_SIZE(hooksets); i++) {
                const struct libmnt_hookset *hs = hooksets[i];