forked from Imagelibrary/rtems
posix/aio_misc.c/aio_init(): lock before accessing data
Coverity CID 1592924 added lock before accessing data. Closes #5129.
This commit is contained in:
committed by
Amar Takhar
parent
de196e0586
commit
617808b979
@@ -133,9 +133,11 @@ int rtems_aio_init( void )
|
||||
if ( result != 0 )
|
||||
pthread_attr_destroy( &aio_request_queue.attr );
|
||||
|
||||
pthread_mutex_lock( &aio_request_queue.mutex );
|
||||
|
||||
result = pthread_cond_init( &aio_request_queue.new_req, NULL );
|
||||
if ( result != 0 ) {
|
||||
pthread_mutex_unlock( &aio_request_queue.mutex );
|
||||
pthread_mutex_destroy( &aio_request_queue.mutex );
|
||||
pthread_attr_destroy( &aio_request_queue.attr );
|
||||
}
|
||||
@@ -148,6 +150,8 @@ int rtems_aio_init( void )
|
||||
atomic_init( &aio_request_queue.queued_requests, 0 );
|
||||
aio_request_queue.initialized = AIO_QUEUE_INITIALIZED;
|
||||
|
||||
pthread_mutex_unlock( &aio_request_queue.mutex );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user