Skip to content

Commit cebb554

Browse files
authored
Fix order of calloc parameters
calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument. earlier argument should specify number of elements, later size of each element
1 parent 1838371 commit cebb554

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

components/calibration/calibration.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ esp_err_t calibration_init(calibration_handle_t *handler, size_t count, calibrat
7272
handler->type = type;
7373
handler->count = count;
7474
handler->filled = 0;
75-
handler->points = calloc(sizeof(calibration_point_t), handler->count);
75+
handler->points = calloc(handler->count, sizeof(calibration_point_t));
7676
if (!handler->points)
7777
{
7878
ESP_LOGE(TAG, "Could not allocate memory for calibration points");

0 commit comments

Comments
 (0)