Commit 9096d8be0d9889e8722ca0be29d528d8c6725fbf

Stefan Sperling 2018-03-03T14:09:51

prevent crash in packfile test if pack file doesn't exist

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/regress/packfiles/packfile_test.c b/regress/packfiles/packfile_test.c
index 4889b1d..5be02f7 100644
--- a/regress/packfiles/packfile_test.c
+++ b/regress/packfiles/packfile_test.c
@@ -46,9 +46,9 @@ packfile_read_idx(const char *repo_path)
 	if (err) {
 		printf("got_packidx_open: %s\n", err->msg);
 		ret = 0;
-	}
+	} else
+		got_packidx_close(packidx);
 
-	got_packidx_close(packidx);
 	free(fullpath);
 	return ret;
 }