Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0384d37

Browse files
committed
Fix for libpgtcl from Constantin Teodorescu.
1 parent 5004b99 commit 0384d37

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/interfaces/libpgtcl/pgtclCmds.c

+9-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.15 1997/09/08 02:40:15 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.16 1997/09/25 15:48:51 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1339,9 +1339,11 @@ Pg_select(ClientData cData, Tcl_Interp * interp, int argc, char **argv)
13391339

13401340
if ((r = Tcl_Eval(interp, argv[4])) != TCL_OK && r != TCL_CONTINUE)
13411341
{
1342-
if (r == TCL_BREAK)
1342+
if (r == TCL_BREAK) {
1343+
/* I suppose that memory used by info and result must be released */
1344+
free(info); PQclear(result);Tcl_UnsetVar(interp, argv[3], 0);
13431345
return TCL_OK;
1344-
1346+
}
13451347
if (r == TCL_ERROR)
13461348
{
13471349
char msg[60];
@@ -1350,12 +1352,15 @@ Pg_select(ClientData cData, Tcl_Interp * interp, int argc, char **argv)
13501352
interp->errorLine);
13511353
Tcl_AddErrorInfo(interp, msg);
13521354
}
1353-
1355+
/* also, releasing memory used by info and result */
1356+
free(info); PQclear(result);Tcl_UnsetVar(interp, argv[3], 0);
13541357
return r;
13551358
}
13561359
}
13571360

13581361
free(info);
1362+
/* Release memory used by result */
1363+
PQclear(result);
13591364
Tcl_UnsetVar(interp, argv[3], 0);
13601365
Tcl_AppendResult(interp, "", 0);
13611366
return TCL_OK;

0 commit comments

Comments
 (0)