summaryrefslogtreecommitdiffstats
path: root/generic/tclIOCmd.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-04-21 18:55:41 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-04-21 18:55:41 (GMT)
commita07adf4d6d28771d9aa74ef06526e5fb3035f5c1 (patch)
treef4294bd466e879159dfdc4825d23afe702d9183c /generic/tclIOCmd.c
parent87f75437c09a8e8fbe5fe0eaa68200c773799e28 (diff)
downloadtcl-a07adf4d6d28771d9aa74ef06526e5fb3035f5c1.zip
tcl-a07adf4d6d28771d9aa74ef06526e5fb3035f5c1.tar.gz
tcl-a07adf4d6d28771d9aa74ef06526e5fb3035f5c1.tar.bz2
Added a refcounting mechanism to ChannelBuffers. Other edits to
stop segfaults in tests iocmd-21.2[12].
Diffstat (limited to 'generic/tclIOCmd.c')
-rw-r--r--generic/tclIOCmd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c
index 2958bc8..7e8e91a 100644
--- a/generic/tclIOCmd.c
+++ b/generic/tclIOCmd.c
@@ -447,6 +447,7 @@ Tcl_ReadObjCmd(
resultPtr = Tcl_NewObj();
Tcl_IncrRefCount(resultPtr);
+ Tcl_Preserve(chan);
charactersRead = Tcl_ReadChars(chan, resultPtr, toRead, 0);
if (charactersRead < 0) {
/*
@@ -462,6 +463,7 @@ Tcl_ReadObjCmd(
TclGetString(chanObjPtr), "\": ",
Tcl_PosixError(interp), NULL);
}
+ Tcl_Release(chan);
Tcl_DecrRefCount(resultPtr);
return TCL_ERROR;
}
@@ -480,6 +482,7 @@ Tcl_ReadObjCmd(
}
}
Tcl_SetObjResult(interp, resultPtr);
+ Tcl_Release(chan);
Tcl_DecrRefCount(resultPtr);
return TCL_OK;
}