|
|
@@ -243,22 +243,22 @@ static inline int hdb_handle_get (
|
|
|
|
|
|
hdb_database_lock (&handle_database->lock);
|
|
|
|
|
|
- if (check != 0xffffffff &&
|
|
|
- check != handle_database->handles[handle].check) {
|
|
|
-
|
|
|
+ *instance = NULL;
|
|
|
+ if (handle >= handle_database->handle_count) {
|
|
|
hdb_database_unlock (&handle_database->lock);
|
|
|
errno = EBADF;
|
|
|
return (-1);
|
|
|
}
|
|
|
|
|
|
- *instance = NULL;
|
|
|
- if (handle >= handle_database->handle_count) {
|
|
|
+ if (handle_database->handles[handle].state != HDB_HANDLE_STATE_ACTIVE) {
|
|
|
hdb_database_unlock (&handle_database->lock);
|
|
|
errno = EBADF;
|
|
|
return (-1);
|
|
|
}
|
|
|
|
|
|
- if (handle_database->handles[handle].state != HDB_HANDLE_STATE_ACTIVE) {
|
|
|
+ if (check != 0xffffffff &&
|
|
|
+ check != handle_database->handles[handle].check) {
|
|
|
+
|
|
|
hdb_database_unlock (&handle_database->lock);
|
|
|
errno = EBADF;
|
|
|
return (-1);
|
|
|
@@ -281,6 +281,13 @@ static inline int hdb_handle_put (
|
|
|
|
|
|
hdb_database_lock (&handle_database->lock);
|
|
|
|
|
|
+ if (handle >= handle_database->handle_count) {
|
|
|
+ hdb_database_unlock (&handle_database->lock);
|
|
|
+
|
|
|
+ errno = EBADF;
|
|
|
+ return (-1);
|
|
|
+ }
|
|
|
+
|
|
|
if (check != 0xffffffff &&
|
|
|
check != handle_database->handles[handle].check) {
|
|
|
|
|
|
@@ -313,6 +320,13 @@ static inline int hdb_handle_destroy (
|
|
|
|
|
|
hdb_database_lock (&handle_database->lock);
|
|
|
|
|
|
+ if (handle >= handle_database->handle_count) {
|
|
|
+ hdb_database_unlock (&handle_database->lock);
|
|
|
+
|
|
|
+ errno = EBADF;
|
|
|
+ return (-1);
|
|
|
+ }
|
|
|
+
|
|
|
if (check != 0xffffffff &&
|
|
|
check != handle_database->handles[handle].check) {
|
|
|
hdb_database_unlock (&handle_database->lock);
|