link implemented but have memory leak

link creation and solving implemented but make app crash in others
function. Suspect a memory leak and need to make malloc clean.