[Python-checkins] r78643 - in python/branches/release31-maint: Misc/NEWS Modules/_lsprof.c

victor.stinner python-checkins at python.org
Thu Mar 4 01:33:35 CET 2010


Author: victor.stinner
Date: Thu Mar  4 01:33:35 2010
New Revision: 78643

Log:
Merged revisions 78642 via svnmerge from 
svn+ssh://pythondev@svn.python.org/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://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.
  ........
................


Modified:
   python/branches/release31-maint/   (props changed)
   python/branches/release31-maint/Misc/NEWS
   python/branches/release31-maint/Modules/_lsprof.c

Modified: python/branches/release31-maint/Misc/NEWS
==============================================================================
--- python/branches/release31-maint/Misc/NEWS	(original)
+++ python/branches/release31-maint/Misc/NEWS	Thu Mar  4 01:33:35 2010
@@ -100,6 +100,9 @@
 Library
 -------
 
+- Issue #7494: fix a crash in _lsprof (cProfile) after clearing the profiler,
+  reset also the pointer to the current pointer context.
+
 - Issue #7250: Fix info leak of os.environ across multi-run uses of
   wsgiref.handlers.CGIHandler.
 

Modified: python/branches/release31-maint/Modules/_lsprof.c
==============================================================================
--- python/branches/release31-maint/Modules/_lsprof.c	(original)
+++ python/branches/release31-maint/Modules/_lsprof.c	Thu Mar  4 01:33:35 2010
@@ -303,12 +303,17 @@
 {
 	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


More information about the Python-checkins mailing list