Skip to content

Commit d84d408

Browse files
committed
Fix pconnect keepalive check not freeing statement fully
The code to free statement resources frees everything held by the structure, but not the statement resource itself, since I believe these can be allocated outside of new_struct. The free code seems to call the special free function then PHP efree, so we'll do the same in the pconnect check.
1 parent e6efb27 commit d84d408

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ibm_db2.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2389,12 +2389,14 @@ static int _php_db2_connect_helper( INTERNAL_FUNCTION_PARAMETERS, conn_handle **
23892389
}
23902390
SQLFreeHandle( SQL_HANDLE_STMT, try_stmt_res->hstmt);
23912391
_php_db2_free_result_struct(try_stmt_res);
2392+
efree(try_stmt_res);
23922393
/* 1.9.7 - IBM i level 3: try allocate new statement (check allocate) */
23932394
} else if (IBM_DB2_G(i5_check_pconnect) >= 3) {
23942395
try_stmt_res = _db2_new_stmt_struct(conn_res);
23952396
rc = SQLAllocHandle(SQL_HANDLE_STMT, conn_res->hdbc, &(try_stmt_res->hstmt));
23962397
SQLFreeHandle( SQL_HANDLE_STMT, try_stmt_res->hstmt);
23972398
_php_db2_free_result_struct(try_stmt_res);
2399+
efree(try_stmt_res);
23982400
/* 1.9.7 - IBM i level 2: try conn get info (check meta data) */
23992401
} else if (IBM_DB2_G(i5_check_pconnect) >=2 ) {
24002402
memset(server, 0, sizeof(server));

0 commit comments

Comments
 (0)