Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit da13545

Browse files
author
Victor Stinner
committed
Merged revisions 78642 via svnmerge from
svn+ssh://[email protected]/python/branches/py3k ................ r78642 | victor.stinner | 2010-03-04 01:29:24 +0100 (jeu., 04 mars 2010) | 10 lines Merged revisions 78641 via svnmerge from svn+ssh://[email protected]/python/trunk ........ r78641 | victor.stinner | 2010-03-04 01:10:12 +0100 (jeu., 04 mars 2010) | 3 lines Issue #7494: fix a crash in _lsprof (cProfile) after clearing the profiler, reset also the pointer to the current pointer context. ........ ................
1 parent ef32bc8 commit da13545

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ Core and Builtins
100100
Library
101101
-------
102102

103+
- Issue #7494: fix a crash in _lsprof (cProfile) after clearing the profiler,
104+
reset also the pointer to the current pointer context.
105+
103106
- Issue #7250: Fix info leak of os.environ across multi-run uses of
104107
wsgiref.handlers.CGIHandler.
105108

Modules/_lsprof.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,17 @@ static void clearEntries(ProfilerObject *pObj)
303303
{
304304
RotatingTree_Enum(pObj->profilerEntries, freeEntry, NULL);
305305
pObj->profilerEntries = EMPTY_ROTATING_TREE;
306-
/* release the memory hold by the free list of ProfilerContexts */
306+
/* release the memory hold by the ProfilerContexts */
307+
if (pObj->currentProfilerContext) {
308+
free(pObj->currentProfilerContext);
309+
pObj->currentProfilerContext = NULL;
310+
}
307311
while (pObj->freelistProfilerContext) {
308312
ProfilerContext *c = pObj->freelistProfilerContext;
309313
pObj->freelistProfilerContext = c->previous;
310314
free(c);
311315
}
316+
pObj->freelistProfilerContext = NULL;
312317
}
313318

314319
static void

0 commit comments

Comments
 (0)