move assignment closer to check in parse_ref_file()
diff --git a/lib/reference.c b/lib/reference.c
index b90b966..b892f24 100644
--- a/lib/reference.c
+++ b/lib/reference.c
@@ -152,11 +152,12 @@ parse_ref_file(struct got_reference **ref, const char *name,
const char *abspath)
{
const struct got_error *err = NULL;
- FILE *f = fopen(abspath, "rb");
+ FILE *f;
char *line;
size_t len;
const char delim[3] = {'\0', '\0', '\0'};
+ f = fopen(abspath, "rb");
if (f == NULL)
return NULL;