If we want to access any objects that use reference counting, we will
increment and then decrement the reference counter of struct pakfire.
This will cause that pakfire_free() will be called multiple times which
will go wrong.
This change blocks that that will happen.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
int destroy_on_free:1;
int mount_tmpfs:1;
int pool_ready:1;
+ int in_free:1;
};
/*
}
static void pakfire_free(struct pakfire* pakfire) {
+ // Avoid recursive free
+ if (pakfire->in_free++)
+ return;
+
// Release GPGME context
if (pakfire->gpgctx)
pakfire_keystore_destroy(pakfire, &pakfire->gpgctx);