cvs: php4 /ext/oci8/ oci8.c

[email protected] ("Thies C. Arntzen") Tue, 30 May 2000 09:25:02 -0000
Newsgroups php.version4
Message-ID <cvsthies959678702@cvsserver>
thies		Tue May 30 02:25:02 2000 EDT

  Modified files:
    /php4/ext/oci8	oci8.c 
  Log:
  @- fixed crash in OCIParse when parsing invalid SQL. (Thies)
  
  
Index: php4/ext/oci8/oci8.c
diff -u php4/ext/oci8/oci8.c:1.84 php4/ext/oci8/oci8.c:1.85
--- php4/ext/oci8/oci8.c:1.84	Thu May 25 00:44:45 2000
+++ php4/ext/oci8/oci8.c	Tue May 30 02:25:02 2000
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: oci8.c,v 1.84 2000/05/25 07:44:45 thies Exp $ */
+/* $Id: oci8.c,v 1.85 2000/05/30 09:25:02 thies Exp $ */
 
 /* TODO list:
  *
@@ -1098,7 +1098,9 @@
 									  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 @@
 
 	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;
+	}
 }
 
 /* }}} */