You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tcl.apache.org by mx...@apache.org on 2022/02/13 15:14:24 UTC

[tcl-rivet] branch master updated: fixed possible memory leak in Rivet_Var

This is an automated email from the ASF dual-hosted git repository.

mxmanghi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tcl-rivet.git


The following commit(s) were added to refs/heads/master by this push:
     new dceb6ce  fixed possible memory leak in Rivet_Var
dceb6ce is described below

commit dceb6ceee68caac045302b8eaf34ef1a633241e9
Author: Massimo Manghi <ma...@gmail.com>
AuthorDate: Sun Feb 13 16:14:11 2022 +0100

    fixed possible memory leak in Rivet_Var
---
 VERSION                      |  2 +-
 src/mod_rivet_ng/rivetCore.c | 11 ++++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/VERSION b/VERSION
index e4604e3..be94e6f 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.2.1
+3.2.2
diff --git a/src/mod_rivet_ng/rivetCore.c b/src/mod_rivet_ng/rivetCore.c
index 1554bb2..dbbb81c 100644
--- a/src/mod_rivet_ng/rivetCore.c
+++ b/src/mod_rivet_ng/rivetCore.c
@@ -742,7 +742,7 @@ TCL_CMD_HEADER ( Rivet_Var )
 
         if (TclWeb_GetVarAsList(result, key, source, private->req) != TCL_OK)
         {
-            result = Tcl_NewStringObj("", -1);
+            Tcl_SetStringObj(result,"",-1);
         }
     } else if(!strcmp(command, "names")) {
         if (objc != 2)
@@ -753,7 +753,7 @@ TCL_CMD_HEADER ( Rivet_Var )
 
         if (TclWeb_GetVarNames(result, source, private->req) != TCL_OK)
         {
-            result = Tcl_NewStringObj("", -1);
+            Tcl_SetStringObj(result,"", -1);
         }
     } else if(!strcmp(command, "number")) {
         if (objc != 2)
@@ -769,14 +769,15 @@ TCL_CMD_HEADER ( Rivet_Var )
             Tcl_WrongNumArgs(interp, 2, objv, NULL);
             return TCL_ERROR;
         }
+
         if (TclWeb_GetAllVars(result, source, private->req) != TCL_OK)
         {
-            result = Tcl_NewStringObj("", -1);
+            Tcl_SetStringObj(result,"", -1);
         }
     } else {
         /* bad command  */
-        Tcl_AppendResult(interp, "bad option: must be one of ",
-                         "'get, list, names, number, all'", NULL);
+        Tcl_AppendResult(interp,"bad option: must be one of ",
+                                "'get, list, names, number, all'", NULL);
         return TCL_ERROR;
     }
     Tcl_SetObjResult(interp, result);

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tcl.apache.org
For additional commands, e-mail: commits-help@tcl.apache.org