summaryrefslogtreecommitdiffstats
path: root/Modules/_lsprof.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-03-04 00:10:12 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-03-04 00:10:12 (GMT)
commit56a5153e21666792c6487fc98ce100fe6c51ebb3 (patch)
tree5e2daef794e6ddab2d8432cbe0321901f6440e98 /Modules/_lsprof.c
parent71fb87e64c51627564262fd64299f7ac79625404 (diff)
downloadcpython-56a5153e21666792c6487fc98ce100fe6c51ebb3.zip
cpython-56a5153e21666792c6487fc98ce100fe6c51ebb3.tar.gz
cpython-56a5153e21666792c6487fc98ce100fe6c51ebb3.tar.bz2
Issue #7494: fix a crash in _lsprof (cProfile) after clearing the profiler,
reset also the pointer to the current pointer context.
Diffstat (limited to 'Modules/_lsprof.c')
-rw-r--r--Modules/_lsprof.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/_lsprof.c b/Modules/_lsprof.c
index 14bb8f9..8820fcf 100644
--- a/Modules/_lsprof.c
+++ b/Modules/_lsprof.c
@@ -303,12 +303,17 @@ static void clearEntries(ProfilerObject *pObj)
{
RotatingTree_Enum(pObj->profilerEntries, freeEntry, NULL);
pObj->profilerEntries = EMPTY_ROTATING_TREE;
- /* release the memory hold by the free list of ProfilerContexts */
+ /* release the memory hold by the ProfilerContexts */
+ if (pObj->currentProfilerContext) {
+ free(pObj->currentProfilerContext);
+ pObj->currentProfilerContext = NULL;
+ }
while (pObj->freelistProfilerContext) {
ProfilerContext *c = pObj->freelistProfilerContext;
pObj->freelistProfilerContext = c->previous;
free(c);
}
+ pObj->freelistProfilerContext = NULL;
}
static void