The `goto` version was better. C doesn't have exceptions, using `goto` to handle errors is not only common but advised. It's a good way to guarantee that all allocated memory will be freed no matter what.