I have this array:
//array of Runways(Runway is a struct)
Runway* arrOfRunways_All = (Runway*)malloc(sizeof(Runway));
I can't free my dynamic allocated memory array, I noticed that after this part of the code:
int NumOfRunways_All = 0;
//copying all runways to an array, counting runways
while (curRunway != NULL) {
//copying all runways to an array, counting runways
arrOfRunways_All[NumOfRunways_All] = *curRunway;
NumOfRunways_All++;
if (iterator->pNext == NULL) {
break;
}
pAirport tmp = iterator->pNext;
iterator = tmp;
curRunway = iterator->runway;
}
free(arrOfRunways_All);
I get crashed. I checked over and over, it cant be dangling pointer. IDK what else can it be.
Thank you very much;