From 78172e9f5bf112665a0f725df8448e2ed6cc4ebc Mon Sep 17 00:00:00 2001 From: gilteixeira Date: Tue, 7 Mar 2023 12:45:05 +0000 Subject: [PATCH] fixed mem allocs --- src/evcsnm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/evcsnm.c b/src/evcsnm.c index 56b8999..9ea83e2 100644 --- a/src/evcsnm.c +++ b/src/evcsnm.c @@ -80,9 +80,10 @@ static int mk_evcsnm(uint8_t *evcsnm_oer, uint32_t *evcsnm_len) cs_elem0->typeOfReceptacle.size = 1; cs_elem0->typeOfReceptacle.bits_unused = 0; cs_elem0->typeOfReceptacle.buf[0] = 0xff; - cs_elem0->parkingPlacesData->list.array = calloc(4, sizeof(struct ParkingPlacesData *)); + cs_elem0->parkingPlacesData = calloc(1, sizeof(struct ParkingPlacesData)); + cs_elem0->parkingPlacesData->list.array = calloc(4, sizeof(void *)); cs_elem0->parkingPlacesData->list.count = 4; - cs_elem0->parkingPlacesData->list.size = sizeof(struct ParkingPlacesData *) * 4; + cs_elem0->parkingPlacesData->list.size = sizeof(void *) * 4; for(int parckingPlaceIndex = 0; parckingPlaceIndex < 4; parckingPlaceIndex++) { cs_elem0->parkingPlacesData->list.array[parckingPlaceIndex] = calloc(1, sizeof(struct SpotAvailability));