Commit Diff


commit - 505287bea16696d4be0e66f0d9c1db6eafea9fb6
commit + c0a1c016337928d659e5aae2e83e7b0547ac53a6
blob - b90b966fcf07c54227e67486dcda744d603bdc2e
blob + b892f2418486027cfdeeda276d5d00360469d309
--- lib/reference.c
+++ lib/reference.c
@@ -152,11 +152,12 @@ parse_ref_file(struct got_reference **ref, const char 
     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;