if( (r = (ring_t*) vr) == NULL ) {
return;
}
-
+ if( r->data ){
+ free( r->data );
+ }
+ if( r->rgate ){
+ free( r->rgate );
+ }
+ if( r->wgate ){
+ free( r->wgate );
+ }
free( r );
}
if( r->rgate != NULL ) { // if lock exists we must honour it
pthread_mutex_lock( r->rgate );
if( r->tail == r->head ) { // ensure ring didn't go empty while waiting
+ pthread_mutex_unlock( r->rgate );
return NULL;
}
}