From: Thies C. Arntzen Date: Tue, 30 May 2000 09:25:02 +0000 (+0000) Subject: @- fixed crash in OCIParse when parsing invalid SQL. (Thies) X-Git-Tag: PRE_EIGHT_BYTE_ALLOC_PATCH~184 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8c65f816764e9890a4bc1f560ea3c70affff4b05;p=php @- fixed crash in OCIParse when parsing invalid SQL. (Thies) --- diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index 92d0c57516..e52a7619b4 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -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; + } } /* }}} */