malloc not being freed- fixed