removed 'free(curr)'. It was causing issues.