if (arr->idxs != NULL) { // clean up indices for (int i = 0; i < arr->idxs->count; i++) { free(arr->idxs->indices[i]); } free(arr->idxs->indices); free(arr->idxs); }
this segment in createArrayIndices() causes the program to segfault when any smolar function is run more than once in a loop. can be reproduced if run using gdb main (or main.c executable name) then let it run without breakpoints.
there is memory leakage in smCreate. checked using valgrind
if (arr->idxs != NULL) { // clean up indices for (int i = 0; i < arr->idxs->count; i++) { free(arr->idxs->indices[i]); } free(arr->idxs->indices); free(arr->idxs); }
this segment in createArrayIndices() causes the program to segfault when any smolar function is run more than once in a loop. can be reproduced if run using gdb main (or main.c executable name) then let it run without breakpoints.
there is memory leakage in smCreate. checked using valgrind
full valgrind log for main.c executable valgrind-out.txt