From 8c27aa68e56023a71cdef441bed4744809acf867 Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Tue, 22 Jul 2008 06:48:09 +0000 Subject: [PATCH] - Segfault when an exception is thrown on persistent connections --- ext/pdo_oci/oci_statement.c | 2 +- ext/pdo_oci/tests/bug44301.phpt | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 ext/pdo_oci/tests/bug44301.phpt diff --git a/ext/pdo_oci/oci_statement.c b/ext/pdo_oci/oci_statement.c index c41b1bd83f..86a3bc9f50 100755 --- a/ext/pdo_oci/oci_statement.c +++ b/ext/pdo_oci/oci_statement.c @@ -86,7 +86,7 @@ static int oci_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ } if (S->einfo.errmsg) { - efree(S->einfo.errmsg); + pefree(S->einfo.errmsg, stmt->dbh->is_persistent); S->einfo.errmsg = NULL; } diff --git a/ext/pdo_oci/tests/bug44301.phpt b/ext/pdo_oci/tests/bug44301.phpt new file mode 100644 index 0000000000..c0f79356af --- /dev/null +++ b/ext/pdo_oci/tests/bug44301.phpt @@ -0,0 +1,25 @@ +--TEST-- +PDO OCI Bug #44301 (Segfault when an exception is thrown on persistent connections) +--SKIPIF-- + +--FILE-- + true))); +require 'ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory('ext/pdo_oci/tests/common.phpt'); +$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + +try { + $stmt = $db->prepare('SELECT * FROM no_table'); + $stmt->execute(); +} catch (PDOException $e) { + print $e->getMessage(); +} +$db = null; +--EXPECTF-- +SQLSTATE[HY000]: General error: 942 OCIStmtExecute: ORA-00942: table or view does not exist + (%s/ext/pdo_oci/oci_statement.c:%d) -- 2.40.0