Library function was not kiiled

I used SDL thread library.

first.

I created thread of library function which runs in “while(1)” by using my
GUI “start button”.

thread = SDL_CreateThread(int (*fn) (void *) proceed, NULL);
second.

I killed thread by using my GUI “stop button”.
SDL_KillThread(thread);

third.

Again, I pressed start button. As a result of that program was broken.(in
other words “SEGMENT FAULT”

I did know why program was broken through debbuging.

Because the library functions can’t delete memory which was allocated by
"malloc" function.

I wondering what happened.