gsocket: Fix some cases of returning error without setting *error