From 371085075c4a95bb8c4737e3c9db61f800e79537 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Sun, 24 Mar 2024 19:15:50 -0400 Subject: Add error handler for system.platform --- src/deliverable.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') 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])); } -- cgit