summaryrefslogtreecommitdiffstats
path: root/generic/tclScan.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2018-04-27 13:21:27 (GMT)
committerdgp <dgp@users.sourceforge.net>2018-04-27 13:21:27 (GMT)
commit5238a999d546fe6f590a75fc34361e0d545ab47a (patch)
tree86f982c66243157bbcf31d1263ec12b784b20daa /generic/tclScan.c
parentab49bdfd12dd83f49e1151bcc11015d1d389b21d (diff)
parent9e733498f1466c92a943ac1c7843296e7e2e6d64 (diff)
downloadtcl-5238a999d546fe6f590a75fc34361e0d545ab47a.zip
tcl-5238a999d546fe6f590a75fc34361e0d545ab47a.tar.gz
tcl-5238a999d546fe6f590a75fc34361e0d545ab47a.tar.bz2
merge 8.7
Diffstat (limited to 'generic/tclScan.c')
-rw-r--r--generic/tclScan.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/generic/tclScan.c b/generic/tclScan.c
index 113b4c6..0e3da17 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -941,11 +941,24 @@ Tcl_ScanObjCmd(
} else if (flags & SCAN_BIG) {
if (flags & SCAN_UNSIGNED) {
mp_int big;
- if ((Tcl_GetBignumFromObj(interp, objPtr, &big) != TCL_OK)
- || mp_isneg(&big)) {
+ int code = Tcl_GetBignumFromObj(interp, objPtr, &big);
+
+ if (code == TCL_OK) {
+ if (mp_isneg(&big)) {
+ code = TCL_ERROR;
+ }
+ mp_clear(&big);
+ }
+
+ if (code == TCL_ERROR) {
+ if (objs != NULL) {
+ ckfree(objs);
+ }
+ Tcl_DecrRefCount(objPtr);
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"unsigned bignum scans are invalid", -1));
- Tcl_SetErrorCode(interp, "TCL", "FORMAT", "BADUNSIGNED",NULL);
+ Tcl_SetErrorCode(interp, "TCL", "FORMAT",
+ "BADUNSIGNED",NULL);
return TCL_ERROR;
}
}