diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-03-24 19:15:50 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-03-24 19:15:50 -0400 |
commit | 371085075c4a95bb8c4737e3c9db61f800e79537 (patch) | |
tree | 69d0a716a9365d507c0d6eac9fcd3bcb2c205819 | |
parent | 1559605c1d1fc9670e87a349580a170c60049e2b (diff) | |
download | stasis-371085075c4a95bb8c4737e3c9db61f800e79537.tar.gz |
Add error handler for system.platform
-rw-r--r-- | src/deliverable.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/deliverable.c b/src/deliverable.c index 36df20a..fb159f7 100644 --- a/src/deliverable.c +++ b/src/deliverable.c @@ -277,7 +277,11 @@ int delivery_init_platform(struct Delivery *ctx) { return -1; } - ctx->system.platform = calloc(DELIVERY_PLATFORM_MAX, sizeof(*ctx->system.platform)); + ctx->system.platform = calloc(DELIVERY_PLATFORM_MAX + 1, sizeof(*ctx->system.platform)); + if (!ctx->system.platform) { + SYSERROR("Unable to allocate %d records for platform array\n", DELIVERY_PLATFORM_MAX); + return -1; + } for (size_t i = 0; i < DELIVERY_PLATFORM_MAX; i++) { ctx->system.platform[i] = calloc(DELIVERY_PLATFORM_MAXLEN, sizeof(*ctx->system.platform[0])); } |