Commit cf198fdf2a044d2e2f0675c2c6b1cd9cdbcf4fcf

joshaber 2015-07-22T10:51:38

Increment `git__n_inits` before doing `init_once`. Fixes #3318.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/global.c b/src/global.c
index 3f20bfd..cb22424 100644
--- a/src/global.c
+++ b/src/global.c
@@ -330,8 +330,8 @@ int git_libgit2_init(void)
 {
 	int ret;
 
-	pthread_once(&_once_init, init_once);
 	ret = git_atomic_inc(&git__n_inits);
+	pthread_once(&_once_init, init_once);
 
 	return init_error ? init_error : ret;
 }