Example #1
0
/*
* Memory_Shutdown
* 
* NOTE: Should be the last called function before shutdown!
*/
void Memory_Shutdown( void )
{
	mempool_t *pool, *next;

	if( !memory_initialized )
		return;

	// set the cvar to NULL so nothing is printed to non-existing console
	developerMemory = NULL;

	Mem_CheckSentinelsGlobal();

	Mem_FreePool( &zoneMemPool );
	Mem_FreePool( &tempMemPool );

	for( pool = poolChain; pool; pool = next )
	{
		// do it here, because pool is to be freed
		// and the chain will be broken
		next = pool->next;
#ifdef SHOW_NONFREED
		Com_Printf( "Warning: Memory pool %s was never freed\n", pool->name );
#endif
		Mem_FreePool( &pool );
	}

	QMutex_Destroy( &memMutex );

	memory_initialized = qfalse;
}
Example #2
0
/*
* QBufPipe_Destroy
*/
void QBufPipe_Destroy( qbufPipe_t **ppipe ) {
	qbufPipe_t *pipe;

	assert( ppipe != NULL );
	if( !ppipe ) {
		return;
	}

	pipe = *ppipe;
	*ppipe = NULL;

	QMutex_Destroy( &pipe->cmdbuf_mutex );
	QMutex_Destroy( &pipe->nonempty_mutex );
	QCondVar_Destroy( &pipe->nonempty_condvar );
	free( pipe );
}
Example #3
0
void wswcurl_cleanup( void )
{
	if( !wswcurl_mempool )
		return;

	while( http_requests ) {
		wswcurl_delete( http_requests );
	}

	if( curldummy ) {
		qcurl_easy_cleanup( curldummy );
		curldummy = NULL;
	}

	if( curlmulti ) {
		qcurl_multi_cleanup( curlmulti );
		curlmulti = NULL;
	}

	QMutex_Destroy( &curldummy_mutex );

	QMutex_Destroy( &http_requests_mutex );

#ifdef USE_OPENSSL
	if( cryptoLibrary )
	{
		qCRYPTO_set_locking_callback( NULL );
		if( crypto_num_mutexes && crypto_mutexes )
		{
			int mutex_num;
			for( mutex_num = 0; mutex_num < crypto_num_mutexes; mutex_num++ )
				QMutex_Destroy( &crypto_mutexes[mutex_num] );
			WFREE( crypto_mutexes );
			crypto_mutexes = NULL;
		}
		crypto_num_mutexes = 0;
	}
#endif

	if( curlLibrary ) {
		qcurl_global_cleanup();
	}

	wswcurl_unloadlib();

	Mem_FreePool( &wswcurl_mempool );
}
Example #4
0
/*
* Qcommon_Shutdown
*/
void Qcommon_Shutdown( void )
{
	static qboolean isdown = qfalse;

	if( isdown )
	{
		printf( "Recursive shutdown\n" );
		return;
	}
	isdown = qtrue;

	Com_ScriptModule_Shutdown();
	CM_Shutdown();
	Netchan_Shutdown();
	NET_Shutdown();
	Key_Shutdown();

	Steam_UnloadLibrary();

	Qcommon_ShutdownCommands();
	Memory_ShutdownCommands();

	if( log_stats_file )
	{
		FS_FCloseFile( log_stats_file );
		log_stats_file = 0;
	}
	if( log_file )
	{
		FS_FCloseFile( log_file );
		log_file = 0;
	}
	logconsole = NULL;
	FS_Shutdown();

	wswcurl_cleanup();

	Dynvar_Shutdown();
	dynvars_initialized = qfalse;
	Cvar_Shutdown();
	Cmd_Shutdown();
	Cbuf_Shutdown();
	Memory_Shutdown();
	
	QMutex_Destroy( &com_print_mutex );

	QThreads_Shutdown();
}
Example #5
0
void wswcurl_cleanup( void )
{
	while( http_requests ) {
		wswcurl_delete( http_requests );
	}

	if( curldummy ) {
		curl_easy_cleanup( curldummy );
		curldummy = NULL;
	}

	curl_multi_cleanup( curlmulti );
	curlmulti = NULL;

	QMutex_Destroy( &http_requests_mutex );

	Mem_FreePool( &wswcurl_mempool );
}
Example #6
0
/*
* CL_MasterAddressCache_Shutdown
*/
static void CL_MasterAddressCache_Shutdown( void )
{
	unsigned i;
	trie_dump_t *dump;

	if( resolverThreads ) {
		for( i = 0; resolverThreads[i]; i++ ) {
			QThread_Join( resolverThreads[i] );
		}
		free( resolverThreads );
		resolverThreads = NULL;
	}

	QMutex_Destroy( &resolveLock );

	// free allocated memory
	Trie_Dump( serverlist_masters_trie, "", TRIE_DUMP_BOTH, &dump );
	for( i = 0; i < dump->size; ++i ) {
		free( dump->key_value_vector[i].value );
	}
	Trie_Destroy( serverlist_masters_trie );
}