]> granicus.if.org Git - php/commitdiff
free errmsg & prevent leaks
authorAntony Dovgal <tony2001@php.net>
Mon, 14 Feb 2005 13:31:34 +0000 (13:31 +0000)
committerAntony Dovgal <tony2001@php.net>
Mon, 14 Feb 2005 13:31:34 +0000 (13:31 +0000)
ext/pdo_oci/oci_driver.c
ext/pdo_oci/oci_statement.c

index 6c8cb80673eb49279903f9bb9955990f05eafde8..e6608c341ab3748649d06ca11ffad132f03c538d 100755 (executable)
@@ -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;
index 446785bfac217f151b2bec396d706eec3a2bfc4a..1d5bbe79807a8c90d04f78d9c19876c2e06cd9ef 100755 (executable)
@@ -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) {