EDIT: I'm closing this question due to poor formulation as suggested by coderredoc.
I had a problem with a free function where I mistakenly put the address of a location an argument.
void freeMemory(Stack stp, int n){
for(int i=0; i<n; i++){
free(&(stp.signals[n].intervals));
}
free(stp.signals);
}
This is the correct code (look below for more info)
void freeMemory(Stack stp, int n){
for(int i=0; i<n; i++){
free(stp.signals[n].intervals);
}
free(stp.signals);
}