Tcl Source Code

Check-in [609c597cb2]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Avoid segfaults when RecordByteCodeStats() is called in a deleted interp.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 609c597cb27644037338413ad1b813cf7b5a25eb
User & Date: dgp 2011-07-15 17:56:06
Context
2011-07-17
15:00
Documentation improvements (small; some revision to parsing script) to improve the quality of HTML d... check-in: 03e341000a user: dkf tags: trunk
2011-07-15
17:56
Avoid segfaults when RecordByteCodeStats() is called in a deleted interp. check-in: 609c597cb2 user: dgp tags: trunk
17:53
Avoid segfaults when RecordByteCodeStats() is called in a deleted interp. check-in: 002be5a1c3 user: dgp tags: core-8-5-branch
14:55
3357771 Prevent circular references in values with ByteCode intreps. check-in: a26a1204dd user: dgp tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.

1



2
3
4
5
6
7
8
2011-07-15  Don Porter  <[email protected]>




	* generic/tclCompile.c:	[Bug 467523, 3357771] Prevent circular
	references in values with ByteCode intreps.  They can lead to
	memory leaks. 

2011-07-14  Donal K. Fellows  <[email protected]>


>
>
>







1
2
3
4
5
6
7
8
9
10
11
2011-07-15  Don Porter  <[email protected]>

	* generic/tclCompile.c: Avoid segfaults when RecordByteCodeStats()
	is called in a deleted interp.

	* generic/tclCompile.c:	[Bug 467523, 3357771] Prevent circular
	references in values with ByteCode intreps.  They can lead to
	memory leaks. 

2011-07-14  Donal K. Fellows  <[email protected]>

Changes to generic/tclCompile.c.

4567
4568
4569
4570
4571
4572
4573





4574
4575
4576
4577
4578
4579
4580
void
RecordByteCodeStats(
    ByteCode *codePtr)		/* Points to ByteCode structure with info
				 * to add to accumulated statistics. */
{
    Interp *iPtr = (Interp *) *codePtr->interpHandle;
    register ByteCodeStats *statsPtr = &iPtr->stats;






    statsPtr->numCompilations++;
    statsPtr->totalSrcBytes += (double) codePtr->numSrcBytes;
    statsPtr->totalByteCodeBytes += (double) codePtr->structureSize;
    statsPtr->currentSrcBytes += (double) codePtr->numSrcBytes;
    statsPtr->currentByteCodeBytes += (double) codePtr->structureSize;








>
>
>
>
>







4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
void
RecordByteCodeStats(
    ByteCode *codePtr)		/* Points to ByteCode structure with info
				 * to add to accumulated statistics. */
{
    Interp *iPtr = (Interp *) *codePtr->interpHandle;
    register ByteCodeStats *statsPtr = &iPtr->stats;

    if (iPtr == NULL) {
	/* Avoid segfaulting in case we're called in a deleted interp */
	return;
    }

    statsPtr->numCompilations++;
    statsPtr->totalSrcBytes += (double) codePtr->numSrcBytes;
    statsPtr->totalByteCodeBytes += (double) codePtr->structureSize;
    statsPtr->currentSrcBytes += (double) codePtr->numSrcBytes;
    statsPtr->currentByteCodeBytes += (double) codePtr->structureSize;