Fix return values of some functions which should return a pointer

https://bugzilla.gnome.org/show_bug.cgi?id=736979