aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2026-04-29 12:43:44 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2026-04-29 12:43:44 -0400
commit2fb4e7bcb14565406fff49ac2e1e0bc5e3243d24 (patch)
treec337cadd91b07f5b5d7f368b99b29abcf6e479f1 /src
parent8c43af24466648338a5b5d2075f88bbc961143fb (diff)
downloadstasis-2fb4e7bcb14565406fff49ac2e1e0bc5e3243d24.tar.gz
delivery_duplicate: free context on error
Diffstat (limited to 'src')
-rw-r--r--src/lib/delivery/delivery.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/delivery/delivery.c b/src/lib/delivery/delivery.c
index def7e38..089d42b 100644
--- a/src/lib/delivery/delivery.c
+++ b/src/lib/delivery/delivery.c
@@ -66,12 +66,13 @@ struct Delivery *delivery_duplicate(struct Delivery *ctx) {
result->rules._handle = malloc(sizeof(*result->rules._handle));
if (!result->rules._handle) {
SYSERROR("%s", "unable to allocate space for INIFILE handle");
+ delivery_free(ctx);
return NULL;
}
result->rules._handle->section = malloc(ctx->rules._handle->section_count * sizeof(**ctx->rules._handle->section));
if (!result->rules._handle->section) {
- guard_free(result->rules._handle);
SYSERROR("%s", "unable to allocate space for INIFILE section");
+ delivery_free(ctx);
return NULL;
}
memcpy(result->rules._handle, &ctx->rules._handle, sizeof(*ctx->rules._handle));
@@ -112,6 +113,7 @@ struct Delivery *delivery_duplicate(struct Delivery *ctx) {
result->system.platform = malloc(DELIVERY_PLATFORM_MAX * sizeof(*result->system.platform));
if (!result->system.platform) {
SYSERROR("%s", "unable to allocate space for system platform array");
+ delivery_free(ctx);
return NULL;
}
for (size_t i = 0; i < DELIVERY_PLATFORM_MAX; i++) {