From 6d6a6a1c25672b69ed80985b54a5fd8da2125751 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 12 May 2026 10:43:17 -0400 Subject: free platform array on error --- src/lib/delivery/delivery_init.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/lib/delivery/delivery_init.c b/src/lib/delivery/delivery_init.c index 48124c2..5bc326d 100644 --- a/src/lib/delivery/delivery_init.c +++ b/src/lib/delivery/delivery_init.c @@ -203,6 +203,7 @@ int delivery_init_platform(struct Delivery *ctx) { ctx->system.platform[i] = calloc(DELIVERY_PLATFORM_MAXLEN, sizeof(*ctx->system.platform[0])); if (!ctx->system.platform[i]) { SYSERROR("Unable to allocate record %zu in platform array", i); + guard_array_n_free(ctx->system.platform, i); return -1; } } @@ -210,6 +211,8 @@ int delivery_init_platform(struct Delivery *ctx) { ctx->system.arch = strdup(uts.machine); if (!ctx->system.arch) { // memory error + guard_array_n_free(ctx->system.platform, DELIVERY_PLATFORM_MAX); + ctx->system.platform = NULL; return -1; } -- cgit