View | Details | Raw Unified | Return to bug 51273
Collapse All | Expand All

(-)../generic/tclEncoding.c (-8 / +8 lines)
Lines 310-328 Link Here
310
{
310
{
311
    Tcl_HashSearch search;
311
    Tcl_HashSearch search;
312
    Tcl_HashEntry *hPtr;
312
    Tcl_HashEntry *hPtr;
313
    Encoding *encodingPtr;
314
313
315
    Tcl_MutexLock(&encodingMutex);
314
    Tcl_MutexLock(&encodingMutex);
316
    encodingsInitialized  = 0;
315
    encodingsInitialized  = 0;
317
    hPtr = Tcl_FirstHashEntry(&encodingTable, &search);
316
    hPtr = Tcl_FirstHashEntry(&encodingTable, &search);
318
    while (hPtr != NULL) {
317
    while (hPtr != NULL) {
319
	encodingPtr = (Encoding *) Tcl_GetHashValue(hPtr);
318
	/*
320
	if (encodingPtr->freeProc != NULL) {
319
	 * Call FreeEncoding instead of doing it directly to handle refcounts
321
	    (*encodingPtr->freeProc)(encodingPtr->clientData);
320
	 * like escape encodings use.  [Bug #524674]
322
	}
321
	 * Make sure to call Tcl_FirstHashEntry repeatedly so that all
323
	ckfree((char *) encodingPtr->name);
322
	 * encodings are eventually cleaned up.
324
	ckfree((char *) encodingPtr);
323
	 */
325
	hPtr = Tcl_NextHashEntry(&search);
324
	FreeEncoding((Tcl_Encoding) Tcl_GetHashValue(hPtr));
325
	hPtr = Tcl_FirstHashEntry(&encodingTable, &search);
326
    }
326
    }
327
    Tcl_DeleteHashTable(&encodingTable);
327
    Tcl_DeleteHashTable(&encodingTable);
328
    Tcl_MutexUnlock(&encodingMutex);
328
    Tcl_MutexUnlock(&encodingMutex);

Return to bug 51273