Fix leak when pack cache is rebuilt.
authorDamien Tournoud <damien@commerceguys.com>
Thu, 17 Apr 2014 08:29:04 +0000 (10:29 +0200)
committerDamien Tournoud <damien@commerceguys.com>
Thu, 17 Apr 2014 08:31:18 +0000 (10:31 +0200)
dulwich/object_store.py

index a6e15662a8a1478a622f8d4c7f9001ff19676678..bb3117a06ffcb4c6296661ed8ccbc7c54acfbf71 100644 (file)
@@ -303,7 +303,10 @@ class PackBasedObjectStore(BaseObjectStore):
     @property
     def packs(self):
         """List with pack objects."""
-        if self._pack_cache is None or self._pack_cache_stale():
+        if self._pack_cache is not None and self._pack_cache_stale():
+            self.close()
+
+        if self._pack_cache is None:
             self._pack_cache = self._load_packs()
         return self._pack_cache