Browse Source

free errmsg & prevent leaks

PHP-5.1
Antony Dovgal 22 years ago
parent
commit
7d4bf3ccd9
  1. 12
      ext/pdo_oci/oci_driver.c
  2. 5
      ext/pdo_oci/oci_statement.c

12
ext/pdo_oci/oci_driver.c

@ -63,6 +63,11 @@ ub4 _oci_error(OCIError *err, pdo_dbh_t *dbh, pdo_stmt_t *stmt, char *what, swor
einfo = &H->einfo;
if (einfo->errmsg) {
pefree(einfo->errmsg, dbh->is_persistent);
einfo->errmsg = NULL;
}
if (stmt) {
S = (pdo_oci_stmt*)stmt->driver_data;
einfo = &S->einfo;
@ -184,7 +189,12 @@ static int oci_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */
OCIHandleFree(H->env, OCI_HTYPE_ENV);
H->env = NULL;
}
if (H->einfo.errmsg) {
pefree(H->einfo.errmsg, dbh->is_persistent);
H->einfo.errmsg = NULL;
}
pefree(H, dbh->is_persistent);
return 0;

5
ext/pdo_oci/oci_statement.c

@ -81,6 +81,11 @@ static int oci_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC)
stmt->bound_params = NULL;
}
if (S->einfo.errmsg) {
efree(S->einfo.errmsg);
S->einfo.errmsg = NULL;
}
if (S->cols) {
for (i = 0; i < stmt->column_count; i++) {
if (S->cols[i].data) {

Loading…
Cancel
Save