Avoid g_error_free
Rely on g_autoptr()
instead. This avoids having to free the
error.
I looked at c277342f and wondered why not just let glib to the work? If that's not suitable please ignore.
The second patch in this MR fixes two leaks the same way.
I can't test that myself atm so this is just a "should work".