@matheusbsbs / matheus-bagliano / commits / 26a063a10b
Fork 0

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>

Junio C Hamano committed Oct 1, 2006 at 11:41 UTC 26a063a10bca57f65d8fed6c4550a70d44a70b81
1 file changed +2 -1
refs.c
+2 -1
@@ -621,12 +621,13 @@ struct ref_lock *lock_any_ref_for_update(const char *ref, const unsigned char *o
621 return lock_ref_sha1_basic(ref, old_sha1, NULL);
622 }
623
624 +static struct lock_file packlock;
625 +
626 static int repack_without_ref(const char *refname)
627 {
628 struct ref_list *list, *packed_ref_list;
629 int fd;
630 int found = 0;
629 - struct lock_file packlock;
631
632 packed_ref_list = get_packed_refs();
633 for (list = packed_ref_list; list; list = list->next) {