aboutsummaryrefslogtreecommitdiff
path: root/jim-aio.c
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2025-07-07 22:56:36 +1000
committerSteve Bennett <steveb@workware.net.au>2025-07-07 23:03:06 +1000
commit5b72bde554529818ca288d54deac63dd2e428483 (patch)
tree7af7ff60cf3a3f1ba2b23f8adf5a1e9a72afcbc5 /jim-aio.c
parent6c1d558d1df64683184c305250917490940a0062 (diff)
downloadjimtcl-master-next.zip
jimtcl-master-next.tar.gz
jimtcl-master-next.tar.bz2
core: Jim_SetVariable() now frees value on errormaster-next
If the value has a zero reference count, free it in the error path. Otherwise callers can't do: Jim_SetVariable(..., Jim_New...()) in case the object is leaked in the error path. Fix various callers that were previously freeing the object in the error path, and add a test to loop.test to show that this was not. Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jim-aio.c')
-rw-r--r--jim-aio.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/jim-aio.c b/jim-aio.c
index 67483a4..473b4e7 100644
--- a/jim-aio.c
+++ b/jim-aio.c
@@ -637,9 +637,7 @@ static int JimSetVariableSocketAddress(Jim_Interp *interp, Jim_Obj *varObjPtr, c
{
int ret;
Jim_Obj *objPtr = JimFormatSocketAddress(interp, sa, salen);
- Jim_IncrRefCount(objPtr);
ret = Jim_SetVariable(interp, varObjPtr, objPtr);
- Jim_DecrRefCount(interp, objPtr);
return ret;
}
@@ -1181,7 +1179,6 @@ static int aio_cmd_gets(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
if (argc) {
if (Jim_SetVariable(interp, argv[0], objPtr) != JIM_OK) {
- Jim_FreeNewObj(interp, objPtr);
return JIM_ERR;
}