diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-04-22 11:25:37 -0400 |
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-04-22 11:25:50 -0400 |
| commit | d1b5c231cfcc1543e64c89364e2f72172d1d501e (patch) | |
| tree | 642f9875a8fcee41316d3da6e85a1ea7290d79bd /src | |
| parent | 33febf2c63a7907c650bbd3730e96f0caea9198f (diff) | |
| download | stasis-d1b5c231cfcc1543e64c89364e2f72172d1d501e.tar.gz | |
delivery_duplicate: return on memory error
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/delivery/delivery.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/lib/delivery/delivery.c b/src/lib/delivery/delivery.c index a068923..e32a805 100644 --- a/src/lib/delivery/delivery.c +++ b/src/lib/delivery/delivery.c @@ -62,6 +62,7 @@ struct Delivery *delivery_duplicate(const struct Delivery *ctx) { memcpy(&result->rules.content, &ctx->rules.content, sizeof(ctx->rules.content)); if (ctx->rules._handle) { + /* result->rules._handle = malloc(sizeof(*result->rules._handle)); result->rules._handle->section = malloc(result->rules._handle->section_count * sizeof(*result->rules._handle->section)); memcpy(result->rules._handle, &ctx->rules._handle, sizeof(*ctx->rules._handle)); @@ -99,6 +100,10 @@ struct Delivery *delivery_duplicate(const struct Delivery *ctx) { result->system.arch = strdup_maybe(ctx->system.arch); if (ctx->system.platform) { 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"); + return NULL; + } for (size_t i = 0; i < DELIVERY_PLATFORM_MAX; i++) { result->system.platform[i] = strdup_maybe(ctx->system.platform[i]); } |
