Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: a0a600921bed34230b09f1d02da76e9ea21241dac75ed9cfbaeeba0734b08fef
Ticket: c58729527114216540ced9f26d1e3afd602f9410
Valgrind shows small memory leak after TIP 720 merge
User & Date: apnadkarni on 2025-05-26 16:54:40
Changes

  1. icomment:
    The leak is in the `TclCompileTryCmd`. Line 2887
    
    ```
    		handlers[handlerIdx].matchClause = tmpObj;
    ```
    
    stores an allocated Tcl_Obj. However, handlerIdx itself is not incremented until the bottom of the loop. Thus when there is a jump on error out of the loop to the failedToCompile label, the loop
    
    ```
        while (handlerIdx-- > 0) {
    	if (handlers[handlerIdx].matchClause) {
    	    TclDecrRefCount(handlers[handlerIdx].matchClause);
    	}
        }
    ```
    
    fails to release the object as handlerIdx has not been incremented yet.
    
  2. login: "apnadkarni"
  3. mimetype: "text/x-markdown"