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:
2
pygit2.c
2
pygit2.c
@@ -1658,7 +1658,9 @@ static PyTypeObject BlobType = {
|
|||||||
static void
|
static void
|
||||||
Tag_dealloc(Tag *self)
|
Tag_dealloc(Tag *self)
|
||||||
{
|
{
|
||||||
|
git_tag_close(self->tag);
|
||||||
Py_XDECREF(self->target);
|
Py_XDECREF(self->target);
|
||||||
|
Py_XDECREF(self->repo);
|
||||||
Py_TYPE(self)->tp_free((PyObject*)self);
|
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -54,7 +54,6 @@ class TagTest(utils.BareRepoTestCase):
|
|||||||
self.assertEqual('Tagged root commit.\n', tag.message)
|
self.assertEqual('Tagged root commit.\n', tag.message)
|
||||||
|
|
||||||
commit = tag.target
|
commit = tag.target
|
||||||
del tag
|
|
||||||
self.assertEqual('Initial test data commit.\n', commit.message)
|
self.assertEqual('Initial test data commit.\n', commit.message)
|
||||||
|
|
||||||
def test_new_tag(self):
|
def test_new_tag(self):
|
||||||
|
Reference in New Issue
Block a user