Skip to content

Commit 06e66f0

Browse files
committed
Fix Signature memory leak
1 parent dd1dc75 commit 06e66f0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/signature.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,16 @@ Signature_init(Signature *self, PyObject *args, PyObject *kwds)
8181
void
8282
Signature_dealloc(Signature *self)
8383
{
84-
/* self->obj is the owner of the git_signature, so we musn't free it */
84+
/* self->obj is the owner of the git_signature C structure, so we musn't free it */
8585
if (self->obj) {
8686
Py_CLEAR(self->obj);
8787
} else {
8888
git_signature_free((git_signature *) self->signature);
89-
free(self->encoding);
9089
}
9190

91+
/* we own self->encoding */
92+
free(self->encoding);
93+
9294
PyObject_Del(self);
9395
}
9496

0 commit comments

Comments
 (0)