summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2004-07-15 11:00:14 +0000
committerAntony Dovgal <tony2001@php.net>2004-07-15 11:00:14 +0000
commitf6eb507b2c25eb6f52f2eb7b8c4b1587382cc24c (patch)
tree452facfbf9b9a7f5b4771fa139a6821f794181a2
parenta75608c1de2b34a1c48bcb8ca474449a1566d5f0 (diff)
downloadphp-git-f6eb507b2c25eb6f52f2eb7b8c4b1587382cc24c.tar.gz
fix #29012 (Potential race during first connection) thanks to cjbj at hotmail dot com
-rw-r--r--ext/oci8/oci8.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index 04f697950e..597b177a49 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -2673,13 +2673,13 @@ static oci_session *_oci_open_session(oci_server* server,char *username,char *pa
smart_str_0(&hashed_details);
if (!exclusive) {
+ mutex_lock(mx_lock);
if (zend_ts_hash_find(persistent_sessions, hashed_details.c, hashed_details.len+1, (void **) &session_list) != SUCCESS) {
zend_llist tmp;
/* first session, set up a session list */
zend_llist_init(&tmp, sizeof(oci_session), (llist_dtor_func_t) _session_pcleanup, 1);
zend_ts_hash_update(persistent_sessions, hashed_details.c, hashed_details.len+1, &tmp, sizeof(zend_llist), (void **) &session_list);
} else {
- mutex_lock(mx_lock);
/* session list found, search for an idle session or an already opened session by the current thread */
session = zend_llist_get_first(session_list);
@@ -2692,7 +2692,6 @@ static oci_session *_oci_open_session(oci_server* server,char *username,char *pa
session->thread = thread_id();
}
- mutex_unlock(mx_lock);
}
if (session) {
@@ -2707,6 +2706,7 @@ static oci_session *_oci_open_session(oci_server* server,char *username,char *pa
/* breakthru to open */
}
}
+ mutex_unlock(mx_lock);
}
session = ecalloc(1,sizeof(oci_session));