Skip to content

Commit 7c50d0e

Browse files
committed
Fix a memory leak in the C tracer. Thanks to Yann Malet for reporting it.
1 parent 0ed7fed commit 7c50d0e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Change history for Coverage.py
55
Version 3.2b3
66
-------------
77

8+
- Fixed a memory leak in the C tracer that was introduced in 3.2b1.
9+
810
- The table of contents in the HTML report is now sortable. Thanks,
911
`Chris Adams`_.
1012

coverage/tracer.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,9 @@ Tracer_trace(Tracer *self, PyFrameObject *frame, int what, PyObject *arg)
388388
}
389389
else {
390390
/* Tracing lines: key is simply this_line. */
391-
PyDict_SetItem(self->cur_file_data, MyInt_FromLong(frame->f_lineno), Py_None);
391+
PyObject * this_line = MyInt_FromLong(frame->f_lineno);
392+
PyDict_SetItem(self->cur_file_data, this_line, Py_None);
393+
Py_DECREF(this_line);
392394
}
393395
}
394396
self->last_line = frame->f_lineno;

0 commit comments

Comments
 (0)