# HG changeset patch # User nrich@ii.net # Date 1229932324 0 # Node ID 1d2369ebee214bf1e2967b5c2c929cbbbb769de3 # Parent cf847efefdb5ce211756260de47e4ad54cb2f2f5 Cleanup oracle bind allocations. diff -r cf847efefdb5 -r 1d2369ebee21 dbd/db2/statement.c --- a/dbd/db2/statement.c Mon Dec 22 07:36:54 2008 +0000 +++ b/dbd/db2/statement.c Mon Dec 22 07:52:04 2008 +0000 @@ -52,8 +52,10 @@ if (statement->stmt) { SQLFreeStmt(statement->stmt, SQL_CLOSE); - if (statement->resultset) + if (statement->resultset) { free(statement->resultset); + statement->resultset = NULL; + } if (statement->bind) { int i; @@ -63,6 +65,7 @@ } free(statement->bind); + statement->bind = NULL; } statement->num_result_columns = 0; diff -r cf847efefdb5 -r 1d2369ebee21 dbd/oracle/dbd_oracle.h --- a/dbd/oracle/dbd_oracle.h Mon Dec 22 07:36:54 2008 +0000 +++ b/dbd/oracle/dbd_oracle.h Mon Dec 22 07:52:04 2008 +0000 @@ -34,5 +34,6 @@ OCIStmt *stmt; connection_t *conn; int num_columns; + bindparams_t *bind; } statement_t; diff -r cf847efefdb5 -r 1d2369ebee21 dbd/oracle/statement.c --- a/dbd/oracle/statement.c Mon Dec 22 07:36:54 2008 +0000 +++ b/dbd/oracle/statement.c Mon Dec 22 07:52:04 2008 +0000 @@ -68,6 +68,11 @@ statement->stmt = NULL; } + if (statement->bind) { + free(statement->bind); + statement->bind = NULL; + } + lua_pushboolean(L, ok); return 1; } @@ -254,8 +259,9 @@ return 0; } - bind = (bindparams_t *)malloc(sizeof(bindparams_t) * statement->num_columns); - memset(bind, 0, sizeof(bindparams_t) * statement->num_columns); + statement->bind = (bindparams_t *)malloc(sizeof(bindparams_t) * statement->num_columns); + memset(statement->bind, 0, sizeof(bindparams_t) * statement->num_columns); + bind = statement->bind; for (i = 0; i < statement->num_columns; i++) { rc = OCIParamGet(statement->stmt, OCI_HTYPE_STMT, statement->conn->err, (dvoid **)&bind[i].param, i+1); @@ -434,6 +440,7 @@ statement->conn = conn; statement->stmt = stmt; statement->num_columns = 0; + statement->bind = NULL; luaL_getmetatable(L, DBD_ORACLE_STATEMENT); lua_setmetatable(L, -2);