summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordas <das>2008-03-11 22:25:12 (GMT)
committerdas <das>2008-03-11 22:25:12 (GMT)
commit0e512ef79291d7d330694670a5bf967343f0e1a7 (patch)
tree54656ce94040adc606c7786fb08772234fbf7ebd /generic
parent305fac9df80af99270e7e137c1ede3e47c31769e (diff)
downloadtcl-0e512ef79291d7d330694670a5bf967343f0e1a7.zip
tcl-0e512ef79291d7d330694670a5bf967343f0e1a7.tar.gz
tcl-0e512ef79291d7d330694670a5bf967343f0e1a7.tar.bz2
* generic/tclEncoding.c (LoadEscapeEncoding): avoid leaking escape
sub-encodings, fixes encoding-11.1 failing after iso2022-jp loaded (e.g. TESTFLAGS='-singleproc 1 -match "chan-io-1.8 encoding-11.1"').
Diffstat (limited to 'generic')
-rw-r--r--generic/tclEncoding.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index 930d11d..95f89a4 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclEncoding.c,v 1.58 2007/12/13 15:23:16 dgp Exp $
+ * RCS: @(#) $Id: tclEncoding.c,v 1.59 2008/03/11 22:25:12 das Exp $
*/
#include "tclInt.h"
@@ -1972,6 +1972,7 @@ LoadEscapeEncoding(
final[sizeof(final) - 1] = '\0';
} else {
EscapeSubTable est;
+ Encoding *e;
strncpy(est.sequence, argv[1], sizeof(est.sequence));
est.sequence[sizeof(est.sequence) - 1] = '\0';
@@ -1984,9 +1985,13 @@ LoadEscapeEncoding(
* To avoid infinite recursion in [encoding system iso2022-*]
*/
- Tcl_GetEncoding(NULL, est.name);
-
- est.encodingPtr = NULL;
+ e = (Encoding *) Tcl_GetEncoding(NULL, est.name);
+ if (e && e->toUtfProc != TableToUtfProc &&
+ e->toUtfProc != Iso88591ToUtfProc) {
+ Tcl_FreeEncoding((Tcl_Encoding) e);
+ e = NULL;
+ }
+ est.encodingPtr = e;
Tcl_DStringAppend(&escapeData, (char *) &est, sizeof(est));
}
}