libgit2/libgit2 — pull request #2157 by carlosmn (2014-03-04 19:23:54+00:00)
Title: pack-objects: free memory safely

A few fixes have accumulated in this area which have made the freeing of
data a bit muddy. Make sure to free the data only when needed and once.

When we are going to write a delta to the packfile, we need to free the
data, otherwise leave it. The current version of the code mixes up the
checks for po->data and po->delta_data.

---

This relates to libgit2/rugged#325. I'm not 100% sure if the OOM is a different manifestation of this or not, but it fixes the issue we found when trying to reproduce it.

/cc @ethomson @arrbee