]> granicus.if.org Git - php/commitdiff
@- fixed crash in OCIParse when parsing invalid SQL. (Thies)
authorThies C. Arntzen <thies@php.net>
Tue, 30 May 2000 09:25:02 +0000 (09:25 +0000)
committerThies C. Arntzen <thies@php.net>
Tue, 30 May 2000 09:25:02 +0000 (09:25 +0000)
ext/oci8/oci8.c

index 92d0c575161cef7399fda5751f50a69db691bb6c..e52a7619b421eb314f4818dff7626c56f9495336 100644 (file)
@@ -1098,7 +1098,9 @@ static oci_statement *oci_parse(oci_connection *connection, char *query, int len
                                                                          OCI_NTV_SYNTAX,
                                                                          OCI_DEFAULT));
                if (connection->error) {
-                       /* XXX loose memory */
+                       OCIHandleFree(statement->pStmt, OCI_HTYPE_STMT);
+                       OCIHandleFree(statement->pError, OCI_HTYPE_ERROR);
+                       efree(statement);
                        return 0;
                }
        }
@@ -3680,7 +3682,11 @@ PHP_FUNCTION(ociparse)
 
        statement = oci_parse(connection,(*query)->value.str.val,(*query)->value.str.len);
 
-       RETURN_RESOURCE(statement->id);
+       if (statement) {
+               RETURN_RESOURCE(statement->id);
+       } else {
+               RETURN_FALSE;
+       }
 }
 
 /* }}} */