diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2009-11-22 09:47:45 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2009-11-22 09:47:45 -0500 |
commit | 10bf596cad063b8664e21512ccb9db75eae84e70 (patch) | |
tree | 3a771eba4c4c5f9e753aa6bd483dd0b212a27ba5 | |
parent | fefdf345a788b85633c48012693926c5c3e7261e (diff) | |
download | python-coveragepy-10bf596cad063b8664e21512ccb9db75eae84e70.tar.gz |
Fix a memory leak in the C tracer. Thanks to Yann Malet for reporting it.
-rw-r--r-- | CHANGES.txt | 2 | ||||
-rw-r--r-- | coverage/tracer.c | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index be3e753..84be6db 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -5,6 +5,8 @@ Change history for Coverage.py Version 3.2b3
-------------
+- Fixed a memory leak in the C tracer that was introduced in 3.2b1.
+
- The table of contents in the HTML report is now sortable. Thanks,
`Chris Adams`_.
diff --git a/coverage/tracer.c b/coverage/tracer.c index 8c11570..2ecd187 100644 --- a/coverage/tracer.c +++ b/coverage/tracer.c @@ -388,7 +388,9 @@ Tracer_trace(Tracer *self, PyFrameObject *frame, int what, PyObject *arg) }
else {
/* Tracing lines: key is simply this_line. */
- PyDict_SetItem(self->cur_file_data, MyInt_FromLong(frame->f_lineno), Py_None);
+ PyObject * this_line = MyInt_FromLong(frame->f_lineno);
+ PyDict_SetItem(self->cur_file_data, this_line, Py_None);
+ Py_DECREF(this_line);
}
}
self->last_line = frame->f_lineno;
|