Merge branch 'jk/index-pack-threading-races' into maint
authorJunio C Hamano <gitster@pobox.com>
Tue, 30 Sep 2014 05:09:24 +0000 (22:09 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 30 Sep 2014 05:09:24 +0000 (22:09 -0700)
When receiving an invalid pack stream that records the same object
twice, multiple threads got confused due to a race.

* jk/index-pack-threading-races:
index-pack: fix race condition with duplicate bases

1  2 
builtin/index-pack.c
index 5568a5bc3b69be79f0d5fa09c694fd976c8319cc,885fa93fd3038ad67ea1d74ea7562843efe3ec2a..eebf1a8fc21fd551f3917ad23ab5a45dff302f23
@@@ -157,10 -157,9 +162,11 @@@ static void cleanup_thread(void
        pthread_mutex_destroy(&read_mutex);
        pthread_mutex_destroy(&counter_mutex);
        pthread_mutex_destroy(&work_mutex);
+       pthread_mutex_destroy(&type_cas_mutex);
        if (show_stat)
                pthread_mutex_destroy(&deepest_delta_mutex);
 +      for (i = 0; i < nr_threads; i++)
 +              close(thread_data[i].pack_fd);
        pthread_key_delete(key);
        free(thread_data);
  }