add: if (!_cachedb) { _cachedb = shm_malloc( sizeof(dbt_cache_p) ); if (!_cachedb) { LOG(L_CRIT,"dbtext:dbt_init_cache: no enough shm mem\n"); lock_dealloc(_cachesem); return -1; } *_cachedb = NULL; }
context: int dbt_init_cache(){	if(!_cachesem)	{	/* init locks */		_cachesem = lock_alloc();		if(!_cachesem)		{			LOG(L_CRIT,"dbtext:dbt_init_cache: could not alloc a lock\n");			return -1;		}		if (lock_init(_cachesem)==0)		{			LOG(L_CRIT,"dbtext:dbt_init_cache: could not intialize a lock\n");			lock_dealloc(_cachesem);			return -1;		}	}		return 0;}