summaryrefslogtreecommitdiffstats
path: root/macosx/tclMacOSXFCmd.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2016-03-24 20:15:01 (GMT)
committerdgp <dgp@users.sourceforge.net>2016-03-24 20:15:01 (GMT)
commit413706af15c4f39a0cec781c067faa9eefafd5b8 (patch)
tree4cef640ad3ab62acadf23f72a11ef1dbb1ba54ce /macosx/tclMacOSXFCmd.c
parent8370f3e2755cd93636a048bfd20d661ff7c56cbc (diff)
downloadtcl-413706af15c4f39a0cec781c067faa9eefafd5b8.zip
tcl-413706af15c4f39a0cec781c067faa9eefafd5b8.tar.gz
tcl-413706af15c4f39a0cec781c067faa9eefafd5b8.tar.bz2
Update Tcl_InitStringRep callers to handle OOM condition.
Diffstat (limited to 'macosx/tclMacOSXFCmd.c')
-rw-r--r--macosx/tclMacOSXFCmd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/macosx/tclMacOSXFCmd.c b/macosx/tclMacOSXFCmd.c
index 13a939f..8659e95 100644
--- a/macosx/tclMacOSXFCmd.c
+++ b/macosx/tclMacOSXFCmd.c
@@ -695,9 +695,11 @@ UpdateStringOfOSType(
const int size = TCL_UTF_MAX * 4;
char *dst = Tcl_InitStringRep(objPtr, NULL, size);
OSType osType = (OSType) objPtr->internalRep.longValue;
- Tcl_Encoding encoding = Tcl_GetEncoding(NULL, "macRoman");
+ int written = 0;
+ Tcl_Encoding encoding;
char src[5];
- int written;
+
+ TclOOM(dst, size);
src[0] = (char) (osType >> 24);
src[1] = (char) (osType >> 16);
@@ -705,6 +707,7 @@ UpdateStringOfOSType(
src[3] = (char) (osType);
src[4] = '\0';
+ encoding = Tcl_GetEncoding(NULL, "macRoman");
Tcl_ExternalToUtf(NULL, encoding, src, -1, /* flags */ 0,
/* statePtr */ NULL, dst, size, /* srcReadPtr */ NULL,
/* dstWrotePtr */ &written, /* dstCharsPtr */ NULL);