diff options
Diffstat (limited to 'src/lib/delivery')
| -rw-r--r-- | src/lib/delivery/delivery.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/delivery/delivery.c b/src/lib/delivery/delivery.c index 45b3b35..def7e38 100644 --- a/src/lib/delivery/delivery.c +++ b/src/lib/delivery/delivery.c @@ -11,7 +11,7 @@ static char *strdup_maybe(const char * restrict s) { } return NULL; } -struct Delivery *delivery_duplicate(const struct Delivery *ctx) { +struct Delivery *delivery_duplicate(struct Delivery *ctx) { struct Delivery *result = calloc(1, sizeof(*result)); if (!result) { return NULL; @@ -116,6 +116,12 @@ struct Delivery *delivery_duplicate(const struct Delivery *ctx) { } for (size_t i = 0; i < DELIVERY_PLATFORM_MAX; i++) { result->system.platform[i] = strdup_maybe(ctx->system.platform[i]); + if (!result->system.platform[i]) { + SYSERROR("%s", "unable to allocate record in system platform array"); + guard_array_n_free(result->system.platform, DELIVERY_PLATFORM_MAX); + delivery_free(ctx); + return NULL; + } } } |
