Add DEFINE_ARRAY_FREE_FUNC and mount_image_free_array

This is similar to DEFINE_POINTER_ARRAY_FREE_FUNC, but one
pointer chase less. The name of the outer and inner functions are
specified separately. The inner function does not free, so it'll
be generally something like 'foo_done', but the outer function
does free, so it can be called 'foo_array_free'.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2026-04-10 15:08:02 +02:00
parent bbc6af9ce3
commit 81d2d0270b
6 changed files with 26 additions and 19 deletions
+2 -2
View File
@@ -696,10 +696,10 @@ void exec_context_done(ExecContext *c) {
bind_mount_free_many(c->bind_mounts, c->n_bind_mounts);
c->bind_mounts = NULL;
c->n_bind_mounts = 0;
mount_image_free_many(c->mount_images, c->n_mount_images);
mount_image_free_array(c->mount_images, c->n_mount_images);
c->mount_images = NULL;
c->n_mount_images = 0;
mount_image_free_many(c->extension_images, c->n_extension_images);
mount_image_free_array(c->extension_images, c->n_extension_images);
c->extension_images = NULL;
c->n_extension_images = 0;
c->extension_directories = strv_free(c->extension_directories);