]> granicus.if.org Git - python/commitdiff
Merged revisions 78641 via svnmerge from
authorVictor Stinner <victor.stinner@haypocalc.com>
Thu, 4 Mar 2010 00:29:24 +0000 (00:29 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Thu, 4 Mar 2010 00:29:24 +0000 (00:29 +0000)
svn+ssh://pythondev@svn.python.org/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.
........

Misc/NEWS
Modules/_lsprof.c

index b23a60a62fff81ed116ce4397cd9fdf5767861af..3165733c4cc2004cb5e38a42da25169b351d2557 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -268,6 +268,9 @@ C-API
 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
   class.
 
index 43cb9b12423fed1eac2e1b996c66efb505b02a88..a4951c033b5785e7ab4caacf27af8aeb28199274 100644 (file)
@@ -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