From d5b82e7974566716186a4e9145b21d96dd66b116 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 31 Jan 2025 09:50:52 +0000 Subject: [PATCH] pakfire: Clean up after failing to create a temporary directory Signed-off-by: Michael Tremer --- src/pakfire/pakfire.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pakfire/pakfire.c b/src/pakfire/pakfire.c index 58135e96..7f943b1c 100644 --- a/src/pakfire/pakfire.c +++ b/src/pakfire/pakfire.c @@ -1009,8 +1009,10 @@ int pakfire_create(struct pakfire** pakfire, struct pakfire_ctx* ctx, // Create a new temporary directory path = pakfire_mkdtemp(tmppath); - if (!path) - return -errno; + if (!path) { + r = -errno; + goto ERROR; + } // Destroy the temporary directory afterwards p->internal_flags |= PAKFIRE_DESTROY_ON_FREE; -- 2.39.5