From b83912bf741739c3c8fa764a7fa521a4f2bdf6b9 Mon Sep 17 00:00:00 2001 From: nick black Date: Thu, 10 Oct 2024 10:28:19 -0400 Subject: [PATCH] correct order of parameters to calloc() yes, these are just multiplied, and multiplication of integers is commutative, so the resulting size will be correct either way. with the parameters inverted, however, alignment requirements might be incorrect. --- components/calibration/calibration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/calibration/calibration.c b/components/calibration/calibration.c index 1a03eb91..7886b3ee 100644 --- a/components/calibration/calibration.c +++ b/components/calibration/calibration.c @@ -72,7 +72,7 @@ esp_err_t calibration_init(calibration_handle_t *handler, size_t count, calibrat handler->type = type; handler->count = count; handler->filled = 0; - handler->points = calloc(sizeof(calibration_point_t), handler->count); + handler->points = calloc(handler->count, sizeof(calibration_point_t)); if (!handler->points) { ESP_LOGE(TAG, "Could not allocate memory for calibration points");