Skip to content

Commit 36cd499

Browse files
committed
Fix: Remove extra python reference for pyval
Problem: `to_unicode` returns a new reference, and PyDict_SetItemString increments the reference count of py_val creating a reference leak Solution: Py_DECREF
1 parent 3a7a211 commit 36cd499

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/commit.c

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ Commit_message_trailers__get__(Commit *self)
124124
for (i=0; i < trailer_count; i++) {
125125
py_val = to_unicode(gmt_arr.trailers[i].value, encoding, NULL);
126126
err = PyDict_SetItemString(dict, gmt_arr.trailers[i].key, py_val);
127+
Py_DECREF(py_val);
127128
if (err < 0)
128129
goto error;
129130

0 commit comments

Comments
 (0)