mirror of https://github.com/python/cpython
Issue #7494: fix a crash in _lsprof (cProfile) after clearing the profiler,
reset also the pointer to the current pointer context.
This commit is contained in:
parent
71fb87e64c
commit
56a5153e21
|
@ -41,6 +41,9 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #7494: fix a crash in _lsprof (cProfile) after clearing the profiler,
|
||||||
|
reset also the pointer to the current pointer context.
|
||||||
|
|
||||||
- Issue #7232: Add support for the context manager protocol to the TarFile
|
- Issue #7232: Add support for the context manager protocol to the TarFile
|
||||||
class.
|
class.
|
||||||
|
|
||||||
|
|
|
@ -303,12 +303,17 @@ static void clearEntries(ProfilerObject *pObj)
|
||||||
{
|
{
|
||||||
RotatingTree_Enum(pObj->profilerEntries, freeEntry, NULL);
|
RotatingTree_Enum(pObj->profilerEntries, freeEntry, NULL);
|
||||||
pObj->profilerEntries = EMPTY_ROTATING_TREE;
|
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) {
|
while (pObj->freelistProfilerContext) {
|
||||||
ProfilerContext *c = pObj->freelistProfilerContext;
|
ProfilerContext *c = pObj->freelistProfilerContext;
|
||||||
pObj->freelistProfilerContext = c->previous;
|
pObj->freelistProfilerContext = c->previous;
|
||||||
free(c);
|
free(c);
|
||||||
}
|
}
|
||||||
|
pObj->freelistProfilerContext = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue