]> granicus.if.org Git - python/commitdiff
Merged revisions 78641 via svnmerge from
authorVictor Stinner <victor.stinner@haypocalc.com>
Sun, 21 Mar 2010 13:37:43 +0000 (13:37 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Sun, 21 Mar 2010 13:37:43 +0000 (13:37 +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 ede40a8cf865b83284be0215f7b114374ee18ecd..96dbd20cb6d1198e3ce7671674416296dc000057 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -21,6 +21,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #7494: fix a crash in _lsprof (cProfile) after clearing the profiler,
+  reset also the pointer to the current pointer context.
+
 - Issue #4961: Inconsistent/wrong result of askyesno function in tkMessageBox
   with Tcl/Tk-8.5.
 
index 14bb8f93e84df254bfd6f1932b88a65ae62169fb..8820fcf5ad4384c889b388f538cb906b1b37fe6f 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