aboutsummaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-10-01 11:41:00 -0700
committerJunio C Hamano <junkio@cox.net>2006-10-01 11:41:00 -0700
commit26a063a10bca57f65d8fed6c4550a70d44a70b81 (patch)
tree3b3e69501dbff47de9928f7c148196d2fb6b59e8 /refs.c
parent14c8a681f751c425f47be38a5e98b514f000d499 (diff)
downloadgit-26a063a10bca57f65d8fed6c4550a70d44a70b81.tar.gz
git-26a063a10bca57f65d8fed6c4550a70d44a70b81.tar.xz
Fix refs.c;:repack_without_ref() clean-up path
The function repack_without_ref() passes a lock-file structure on the stack to hold_lock_file_for_update(), which in turn registers it to be cleaned up via atexit(). This is a big no-no. This is the same bug James Bottomley fixed with commit 31f584c242e7af28018ff920b6c8d1952beadbd4. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/refs.c b/refs.c
index 221eb3896..aa4c4e0b9 100644
--- a/refs.c
+++ b/refs.c
@@ -621,12 +621,13 @@ struct ref_lock *lock_any_ref_for_update(const char *ref, const unsigned char *o
return lock_ref_sha1_basic(ref, old_sha1, NULL);
}
+static struct lock_file packlock;
+
static int repack_without_ref(const char *refname)
{
struct ref_list *list, *packed_ref_list;
int fd;
int found = 0;
- struct lock_file packlock;
packed_ref_list = get_packed_refs();
for (list = packed_ref_list; list; list = list->next) {