summaryrefslogtreecommitdiff
path: root/src/global.c
Commit message (Collapse)AuthorAgeFilesLines
* error: store the error messages in a reusable buffercmn/error-bufferCarlos Martín Nieto2015-07-281-6/+8
| | | | | | | Instead of allocating a brand new buffer for each error string we want to store, we can use a per-thread buffer to store the error string and re-use the underlying storage. We already use the buffer to format the string, so this mostly makes that more direct.
* Merge branch 'master' into fix-init-orderingfix-init-orderingjoshaber2015-07-221-2/+16
|\
| * Include stacktrace summary in memory leak output.Jeff Hostetler2015-06-291-2/+16
| |
* | Increment `git__n_inits` before doing `init_once`.joshaber2015-07-221-1/+1
|/ | | | Fixes #3318.
* global: Ensure we free our SSL context.Tim Hentenaar2015-06-081-0/+16
|
* Rename GIT_SSL to GIT_OPENSSLCarlos Martín Nieto2015-04-231-4/+4
| | | | | This is what it's meant all along, but now we actually have multiple implementations, it's clearer to use the name of the library.
* Rename routine to free TLS dataJeff Hostetler2015-04-181-2/+7
|
* Remove DllMain now that TLS data freed by threadsJeff Hostetler2015-04-171-8/+0
|
* Also fix leak of TLS data on main thread.Jeff Hostetler2015-04-171-4/+1
|
* Attempt to fix Windows TLS memory leak.Jeff Hostetler2015-04-171-5/+13
|
* libgit2_shutdown: free TLS data (win32)Edward Thomson2015-03-041-0/+11
| | | | Free TLS data on thread exit (win32)
* libgit2_shutdown: clear err message on shutdownEdward Thomson2015-03-041-9/+27
| | | | | | Clear the error message on git_libgit2_shutdown for all versions of the library (no threads and Win32 threads). Drop the giterr_clear in clar, as that shouldn't be necessary.
* Fix leak of TLS error message in shutdown (ptherad version)Leo Yang2015-03-041-3/+3
|
* global: include sys/openssl.h for GIT_EXPORT of fnEdward Thomson2014-12-231-0/+1
| | | | | | The openssl setup function needs to be GIT_EXPORT'ed, be sure to include the `sys/openssl.h` header so that it is appropriately decorated as an export function.
* Make the OpenSSL locking function warnings more severeCarlos Martín Nieto2014-12-121-1/+0
| | | | | Our git_openssl_set_locking() would ideally not exist. Make it clearer that we provide it as a last resort and you should prefer anything else.
* Merge pull request #2743 from ethomson/init_valCarlos Martín Nieto2014-12-051-14/+30
|\ | | | | init: return the number of initializations
| * init: return the number of initializationsEdward Thomson2014-12-041-14/+30
| |
* | Add missing else directiveStefan Widgren2014-12-031-0/+1
|/ | | | | Add missing else directive to fix compiler warning: control reaches end of non-void function
* Plug possible leak in the openssl locksUngureanu Marius2014-11-171-0/+6
|
* Rename git_threads_ to git_libgit2_Carlos Martín Nieto2014-11-081-10/+11
| | | | | | This describes their purpose better, as we now initialize ssl and some other global stuff in there. Calling the init function is not something which has been optional for a while now.
* Merge pull request #2676 from libgit2/cmn/threadingEdward Thomson2014-11-061-18/+24
|\ | | | | Threading and crypto libraries
| * ssl: separate locking init from general initCarlos Martín Nieto2014-11-011-18/+23
| | | | | | | | | | Extract the lock-setting functions into their own, as we cannot assume that it's ok for us to set this unconditionally.
| * ssl: clear the OpenSSL locking functionCarlos Martín Nieto2014-11-011-0/+1
| | | | | | | | | | We're freeing the memory which holds the locks so we must make sure that the locking function doesn't try to use it.
* | Make the Visual Studio compiler happyJacques Germishuys2014-11-031-7/+8
|/
* global: clean up openssl_locks on shutdownEdward Thomson2014-10-261-1/+7
|
* ssl: dump the SSL ciphers in favour of TLScmn/ssl-tlsCarlos Martín Nieto2014-10-231-0/+13
| | | | | | | | | | All versions of SSL are considered deprecated now, so let's ask OpenSSl to only use TLSv1. We still ask it to load those ciphers for compatibility with servers which want to use an older hello but will use TLS for encryption. For good measure we also disable compression, which can be exploitable, if the OpenSSL version supports it.
* global: free the error message when exiting a threadcmn/free-tls-errorCarlos Martín Nieto2014-09-141-0/+3
| | | | | When we free the global state at thread termination, we must also free the error message in order not to leak the string once per thread.
* Only create openssl_locks if thread support is enabledJacques Germishuys2014-07-131-0/+2
|
* ssl: init only once without threadsCarlos Martín Nieto2014-06-301-1/+7
| | | | | | | | The OpenSSL library-loading functions do not expect to be called multiple times. Add a flag in the non-threaded libgit2 init so we only call once. This fixes #2446.
* Merge pull request #2421 from libgit2/cmn/init-ssl-onceVicent Marti2014-06-141-0/+67
|\ | | | | netops: init OpenSSL once under lock
| * ssl: init everything all the timecmn/init-ssl-onceCarlos Martín Nieto2014-06-121-5/+48
| | | | | | | | | | | | | | | | Bring together all of the OpenSSL initialization to git_threads_init() so it's together and doesn't need locks. Moving it here also gives us libssh2 thread safety (when built against openssl).
| * ssl: init also without threadsCarlos Martín Nieto2014-06-121-9/+10
| |
| * ssl: cargo-cult thread safetyCarlos Martín Nieto2014-06-121-0/+20
| | | | | | | | OpenSSL's tests init everything in the main thread, so let's do that.
| * netops: init OpenSSL once under lockCarlos Martín Nieto2014-06-111-0/+3
| | | | | | | | | | | | | | | | The OpenSSL init functions are not reentrant, which means that running multiple fetches in parallel can cause us to crash. Use a mutex to init OpenSSL, and since we're adding this extra checks, init it only once.
* | Win32: Fix object::cache::threadmania test on x64Philip Kelley2014-06-071-2/+2
|/
* Merge pull request #2303 from jacquesg/mingw-lseekVicent Marti2014-05-191-1/+1
|\ | | | | WIP: Windows fixes
| * _InterlockedExchange expects a volatile LONGJacques Germishuys2014-05-011-1/+1
| |
* | Fix the issues in git_shutdownAnurag Gupta2014-05-061-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1) Call to git_shutdown results in setting git__n_shutdown_callbacks to -1. Next call to git__on_shutdown results in ABW (Array Bound Write) for array git__shutdown_callbacks. In the current Implementation, git_atomic_dec is called git__n_shutdown_callbacks + 1 times. I have modified it to a for loop so that it is more readable. It would not set git__n_shutdown_callbacks to a negative number and reset the elements of git__shutdown_callbacks to NULL. 2) In function git_sysdir_get, shutdown function is registered only if git_sysdir__dirs_shutdown_set is set to 0. However, after this variable is set to 1, it is never reset to 0. If git_sysdir_global_init is called again from synchronized_threads_init it does not register shutdown function for this subsystem.
* | Fix the issues in git__on_shutdownAnurag Gupta2014-05-061-5/+7
|/
* Fix threading tests when threads disabledRussell Belfer2014-04-171-10/+10
|
* Correct C90 warningsJacques Germishuys2014-04-111-1/+2
|
* Move system directory cache out of utilsEdward Thomson2014-02-241-3/+3
|
* Don't use git_atomic as an integerBen Straub2013-10-041-4/+5
|
* Use InterlockedCompareExchange for the lockPhilip Kelley2013-10-041-49/+18
|
* Posix synchronized init, prototype win32 versionBen Straub2013-10-041-34/+89
|
* Add simple global shutdown hooksRussell Belfer2013-09-171-10/+28
| | | | | | | | | | Increasingly there are a number of components that want to do some cleanup at global shutdown time (at least if there are not going to be memory leaks). This creates a very simple system of shutdown hooks that will be invoked by git_threads_shutdown. Right now, the maximum number of hooks is hardcoded, but since adding a hook is not a public API, it should be fine and I thought it was better to start off with really simple code.
* Load SRWLock APIs at runtimeRussell Belfer2013-08-261-4/+8
| | | | | | This loads SRWLock APIs at runtime and in their absence (i.e. on Windows before Vista) falls back on a regular CRITICAL_SECTION that will not permit concurrent readers.
* preload configuration pathsEdward Thomson2013-07-111-5/+4
|
* Mutex init can failRussell Belfer2013-05-311-2/+4
| | | | | | | It is obviously quite a serious problem if this happens, but mutex initialization can fail and we should detect it. It's a bit like a memory allocation failure, in that you're probably pretty screwed if this occurs, but at least we'll catch it.
* Further threading fixesRussell Belfer2013-04-221-0/+6
| | | | | | | | | | | | | This builds on the earlier thread safety work to make it so that setting the odb, index, refdb, or config for a repository is done in a threadsafe manner with minimized locking time. This is done by adding a lock to the repository object and using it to guard the assignment of the above listed pointers. The lock is only held to assign the pointer value. This also contains some minor fixes to the other work with pack files to reduce the time that locks are being held to and fix an apparently memory leak.