[unixODBC-dev] A bug in release_env function
xn212516 at 163.com
Thu Jul 25 10:45:14 BST 2013
Greetings form me!
I found a issue in release_env function. In this function, the env_lib_list is a local varibale, but it points to a gloabl variable connection -> environment -> env_lib_list. So I think the whole code should be protected like this:
static void release_env( DMHDBC connection )
struct env_lib_struct *env_lib_list, *env_lib_prev;
if ( connection -> driver_env )
If not add the mutex in release_env, there will be a thread calls __connect_part_one, which accesses the connection -> environment -> env_lib_list, while the other thread calls release_env, which also accesses the connection -> environment -> env_lib_list. And this will cause unpredictable result, such as core dump.
Please check it, thanks very much!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the unixODBC-dev