diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2014-06-25 21:20:39 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2014-06-25 21:20:39 +0200 |
| commit | 5e0f47c3753c5ddd206ab3af6d2a231ad3da39c4 (patch) | |
| tree | 9cae964bd2c2873112bc05c6face821dff05aa7f /src/pack.c | |
| parent | c61dc1a92e6d7fed6da158b430c206480c1439d7 (diff) | |
| download | libgit2-5e0f47c3753c5ddd206ab3af6d2a231ad3da39c4.tar.gz | |
pack: free the new pack struct if we fail to insert
If we fail to insert the packfile in the map, make sure to free it.
This makes the free function only attempt to remove its mwindows from
the global list if we have opened the packfile to avoid accessing the
list unlocked.
Diffstat (limited to 'src/pack.c')
| -rw-r--r-- | src/pack.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/pack.c b/src/pack.c index 767efb6c3..22dbd5647 100644 --- a/src/pack.c +++ b/src/pack.c @@ -968,10 +968,10 @@ void git_packfile_free(struct git_pack_file *p) cache_free(&p->bases); - git_mwindow_free_all_locked(&p->mwf); - - if (p->mwf.fd >= 0) + if (p->mwf.fd >= 0) { + git_mwindow_free_all_locked(&p->mwf); p_close(p->mwf.fd); + } pack_index_free(p); |
