Hi, thanks for replying, but although I change the allocation following your suggestion, I am still getting the error the the pointer I am freeing was not allocated to begin with.

I don't know where the actual problem would be since I am not freeing it twice throughout the code.

Thanks again