http-push.c::remove_locks(): fix use after free
authorAlex Riesen <raa.lkml@gmail.com>
Sun, 24 May 2009 13:16:49 +0000 (15:16 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sun, 24 May 2009 18:08:31 +0000 (11:08 -0700)
Noticed and reported by Serhat Şevki Dinçer.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Acked-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http-push.c

index 6805288..0696da0 100644 (file)
@@ -1356,8 +1356,9 @@ static void remove_locks(void)
 
        fprintf(stderr, "Removing remote locks...\n");
        while (lock) {
+               struct remote_lock *next = lock->next;
                unlock_remote(lock);
-               lock = lock->next;
+               lock = next;
        }
 }