tags: properly dealloc tags

There were two memory leaks: we were not closing the git_tag object,
and we were not decreasing the refcount on the repo.

This finishes fixing issue #20
This commit is contained in:
J. David Ibáñez
2011-10-18 11:27:32 +02:00
parent af983b989a
commit 73af642b8f
2 changed files with 2 additions and 1 deletions

View File

@@ -1658,7 +1658,9 @@ static PyTypeObject BlobType = {
static void
Tag_dealloc(Tag *self)
{
git_tag_close(self->tag);
Py_XDECREF(self->target);
Py_XDECREF(self->repo);
Py_TYPE(self)->tp_free((PyObject*)self);
}

View File

@@ -54,7 +54,6 @@ class TagTest(utils.BareRepoTestCase):
self.assertEqual('Tagged root commit.\n', tag.message)
commit = tag.target
del tag
self.assertEqual('Initial test data commit.\n', commit.message)
def test_new_tag(self):