Fixed potential memleaks
Merge branch 'master' of https://github.com/mannol1/ProjectTox-Core into mannol1-master