VOID Hvl11Free( _In_ _Post_ptr_invalid_ PHVL pHvl ) { if (NULL != pHvl) { HvlWaitForPendingThreads(pHvl); NdisFreeSpinLock(&(pHvl->Lock)); if (pHvl->CtxSWorkItemHandle) { NdisFreeIoWorkItem(pHvl->CtxSWorkItemHandle); } if (pHvl->NotificationsWorkItemHandle) { NdisFreeIoWorkItem(pHvl->NotificationsWorkItemHandle); } if (pHvl->pPnpOpExReq) { FREE_MEM(pHvl->pPnpOpExReq); } // free the memory allocated for any pending operations HvlDeleteAllPendingOperations(pHvl); FREE_MEM(pHvl); } }
bool MVMul() { bool bRtn = false; double i, j; if (0 == g_matrix.fRowCount || 0 == g_matrix.fColumnCount || 0 == g_vector_input.fRowCount || g_vector_input.fRowCount != g_matrix.fColumnCount) return bRtn; g_vector_output.fRowCount = g_matrix.fRowCount; g_vector_output.pfReal = (double*)malloc(sizeof(double)*g_vector_output.fRowCount); g_vector_output.pfImaginary = (double*)malloc(sizeof(double)*g_vector_output.fRowCount); if (NULL == g_vector_output.pfReal || NULL == g_vector_output.pfImaginary) { FREE_MEM(g_vector_output.pfReal); FREE_MEM(g_vector_output.pfImaginary); return bRtn; } for (i = 0; i < g_matrix.fRowCount; ++i) { g_vector_output.pfReal[(int)i] = 0.; g_vector_output.pfImaginary[(int)i] = 0.; for (j = 0; j < g_matrix.fColumnCount; ++j) { double fMatrixReal = g_matrix.pfReal[(int)i*(int)g_matrix.fColumnCount + (int)j]; double fMatrixImaginary = g_matrix.pfImaginary[(int)i*(int)g_matrix.fColumnCount + (int)j]; g_vector_output.pfReal[(int)i] += fMatrixReal * g_vector_input.pfReal[(int)j] - fMatrixImaginary * g_vector_input.pfImaginary[(int)j]; g_vector_output.pfImaginary[(int)i] += fMatrixReal * g_vector_input.pfImaginary[(int)j] + fMatrixImaginary * g_vector_input.pfReal[(int)j]; } } bRtn = true; return bRtn; }
void hm_req_handle_fetch_buf_free (T_REQ_HANDLE * req_handle) { int i, j, fetched_tuple; if (req_handle->tuple_value) { fetched_tuple = req_handle->fetched_tuple_end - req_handle->fetched_tuple_begin + 1; for (i = 0; i < fetched_tuple; i++) { #if defined(WINDOWS) for (j = 0; j < req_handle->num_col_info; j++) { FREE_MEM (req_handle->tuple_value[i].decoded_ptr[j]); } FREE_MEM (req_handle->tuple_value[i].decoded_ptr); #endif FREE_MEM (req_handle->tuple_value[i].column_ptr); } FREE_MEM (req_handle->tuple_value); } FREE_MEM (req_handle->msg_buf); req_handle->fetched_tuple_begin = req_handle->fetched_tuple_end = 0; req_handle->cur_fetch_tuple_index = -1; req_handle->is_fetch_completed = 0; }
void query_info_clear (T_QUERY_INFO * qi) { FREE_MEM (qi->sql); FREE_MEM (qi->cas_log); qi->start_date[0] = '\0'; }
*/ int OS_Browse(REBCHR *url, int reserved) /* ***********************************************************************/ { #define MAX_BRW_PATH 2044 long flag; long len; long type; HKEY key; REBCHR *path; HWND hWnd = GetFocus(); if (RegOpenKeyEx(HKEY_CLASSES_ROOT, TEXT("http\\shell\\open\\command"), 0, KEY_READ, &key) != ERROR_SUCCESS) return 0; if (!url) url = TEXT(""); path = MAKE_STR(MAX_BRW_PATH+4); len = MAX_BRW_PATH; flag = RegQueryValueEx(key, TEXT(""), 0, &type, (LPBYTE)path, &len); RegCloseKey(key); if (flag != ERROR_SUCCESS) { FREE_MEM(path); return 0; } //if (ExpandEnvironmentStrings(&str[0], result, len)) Insert_Command_Arg(path, url, MAX_BRW_PATH); len = OS_Create_Process(path, 0); FREE_MEM(path); return len; }
static void * extract_host_partition_stat (FILE * fp, const char *arg1, T_CM_ERROR * err_buf) { char linebuf[LINE_MAX]; char type[512]; int nitem = 0; int nalloc = 10; T_CM_DISK_PARTITION_STAT *p = NULL; T_CM_DISK_PARTITION_STAT_ALL *stat = NULL; stat = (T_CM_DISK_PARTITION_STAT_ALL *) malloc (sizeof (T_CM_DISK_PARTITION_STAT_ALL)); p = (T_CM_DISK_PARTITION_STAT *) malloc (nalloc * sizeof (T_CM_DISK_PARTITION_STAT)); if (stat == NULL || p == NULL) { cm_set_error (err_buf, CM_OUT_OF_MEMORY); FREE_MEM (stat); FREE_MEM (p); return NULL; } stat->partitions = p; while (fgets (linebuf, sizeof (linebuf), fp)) { sscanf (linebuf, "%*s%511s", type); if (strstr (type, "ext") == NULL) continue; if (nitem >= nalloc) { nalloc *= 2; stat->partitions = realloc (stat->partitions, nalloc * sizeof (T_CM_DISK_PARTITION_STAT)); } if (stat->partitions) { p = stat->partitions + nitem; sscanf (linebuf, "%255s%*s%llu%llu%llu", p->name, &p->size, &p->used, &p->avail); nitem++; } else { cm_host_disk_partition_stat_free (stat); cm_set_error (err_buf, CM_OUT_OF_MEMORY); return NULL; } } stat->num_stat = nitem; return stat; }
void cm_db_proc_stat_all_free (T_CM_DB_PROC_STAT_ALL * stat) { if (stat != NULL) { FREE_MEM (stat->db_stats); FREE_MEM (stat); } }
void cm_host_disk_partition_stat_free (T_CM_DISK_PARTITION_STAT_ALL * stat) { if (stat != NULL) { FREE_MEM (stat->partitions); FREE_MEM (stat); } }
int CMPIPTV_RTSP::SendRtspCommand(const TCHAR *method, const TCHAR *command, MediaSubsession *subsession) { this->logger.Log(LOGGER_VERBOSE, _T("%s: %s: send %s command"), PROTOCOL_IMPLEMENTATION_NAME, method, command); ResetEvent(this->rtspResponseEvent); if (_tcscmp(command, _T("OPTIONS")) == 0) { this->rtspClient->sendOptionsCommand(&CMPIPTV_RTSP::OnRtspResponseReceived); } else if (_tcscmp(command, _T("DESCRIBE")) == 0) { this->rtspClient->sendDescribeCommand(&CMPIPTV_RTSP::OnRtspResponseReceived); } else if (_tcscmp(command, _T("SETUP")) == 0) { this->rtspClient->sendSetupCommand(*subsession, &CMPIPTV_RTSP::OnRtspResponseReceived); } else if (_tcscmp(command, _T("PLAY")) == 0) { this->rtspClient->sendPlayCommand(*this->rtspSession, &CMPIPTV_RTSP::OnRtspResponseReceived); } else if (_tcscmp(command, _T("TEARDOWN")) == 0) { this->rtspClient->sendTeardownCommand(*this->rtspSession, &CMPIPTV_RTSP::OnRtspResponseReceived); } else { return STATUS_ERROR; } if (WaitForSingleObject(this->rtspResponseEvent, this->rtspCommandResponseTimeout) == WAIT_TIMEOUT) { this->logger.Log(LOGGER_ERROR, _T("%s: %s: %s command timed out"), PROTOCOL_IMPLEMENTATION_NAME, method, command); return STATUS_ERROR; } if (this->rtspResponseResultCode != 0) { #ifdef _MBCS TCHAR *convertedRtspResponse = ConvertToMultiByteA(&this->rtspResponseResultString[0]); #else TCHAR *convertedRtspResponse = ConvertToUnicodeA(&this->rtspResponseResultString[0]); #endif this->logger.Log(LOGGER_ERROR, _T("%s: %s: %s command failed, code = %i, response = %s"), PROTOCOL_IMPLEMENTATION_NAME, method, command, this->rtspResponseResultCode, (convertedRtspResponse == NULL) ? _T("unable to get message") : convertedRtspResponse); FREE_MEM(convertedRtspResponse); return STATUS_ERROR; } #ifdef _MBCS TCHAR *convertedRtspResponse = ConvertToMultiByteA(&this->rtspResponseResultString[0]); #else TCHAR *convertedRtspResponse = ConvertToUnicodeA(&this->rtspResponseResultString[0]); #endif this->logger.Log(LOGGER_VERBOSE, _T("%s: %s: %s command succeeded, response = %s"), PROTOCOL_IMPLEMENTATION_NAME, method, command, (convertedRtspResponse == NULL) ? _T("unable to get message") : convertedRtspResponse); FREE_MEM(convertedRtspResponse); return STATUS_OK; }
void t_set_free (T_SET * set) { if (set == NULL) return; FREE_MEM (set->element); FREE_MEM (set->data_buf); hm_conv_value_buf_clear (&(set->conv_value_buffer)); FREE_MEM (set); }
int net_decode_str (char *msg, int msg_size, char *func_code, void ***ret_argv) { int remain_size = msg_size; char *cur_p = msg; char *argp; int i_val; void **argv = NULL; int argc = 0; *ret_argv = (void **) NULL; if (remain_size < 1) return CAS_ER_COMMUNICATION; *func_code = *cur_p; cur_p += 1; remain_size -= 1; while (remain_size > 0) { if (remain_size < 4) { FREE_MEM (argv); return CAS_ER_COMMUNICATION; } argp = cur_p; memcpy ((char *) &i_val, cur_p, 4); i_val = ntohl (i_val); remain_size -= 4; cur_p += 4; if (remain_size < i_val) { FREE_MEM (argv); return CAS_ER_COMMUNICATION; } argc++; argv = (void **) REALLOC (argv, sizeof (void *) * argc); if (argv == NULL) return CAS_ER_NO_MORE_MEMORY; argv[argc - 1] = argp; cur_p += i_val; remain_size -= i_val; } *ret_argv = argv; return argc; }
int t_set_decode (T_SET * set) { void **element; char *cur_p; int i; int remain_size; int ele_size; if (set->num_element < 0 || set->data_size < 0) return CCI_ER_COMMUNICATION; if (set->num_element == 0 || set->data_size == 0) return 0; element = (void **) MALLOC (sizeof (void *) * set->num_element); if (element == NULL) return CCI_ER_NO_MORE_MEMORY; memset (element, 0, sizeof (void *) * set->num_element); remain_size = set->data_size; cur_p = (char *) set->data_buf; for (i = 0; i < set->num_element; i++) { element[i] = cur_p; if (remain_size < 4) { FREE_MEM (element); return CCI_ER_COMMUNICATION; } NET_STR_TO_INT (ele_size, cur_p); cur_p += 4; remain_size -= 4; if (ele_size <= 0) continue; if (remain_size < ele_size) { FREE_MEM (element); return CCI_ER_COMMUNICATION; } cur_p += ele_size; remain_size -= ele_size; } set->element = element; return 0; }
VOID HvlFreeNotification( PHVL_NOTIFICATION pHvlNotif ) { if (pHvlNotif) { if (pHvlNotif->pvNotif) { FREE_MEM(pHvlNotif->pvNotif); } FREE_MEM(pHvlNotif); } }
DWORD WINAPI WahDestroyContextTable( LPCONTEXT_TABLE Table ) /*++ Routine Description: Destroys an existing context table. Arguments: Table - A pointer to the table to destroy. Return Value: DWORD - NO_ERROR if successful, a Win32 error code if not. --*/ { // // Delete the context table's critical section if necessary. // if( Table->Flags & WAH_CONTEXT_FLAG_SERIALIZE ) { DeleteCriticalSection( TABLE_TO_LOCK( Table ) ); } // // Free the resources. // FREE_MEM( Table->LookupArray ); FREE_MEM( Table ); // // Success! // return NO_ERROR; } // WahDestroyContextTable
int cm_get_db_exec_stat (const char *db_name, T_CM_DB_EXEC_STAT * exec_stat, T_CM_ERROR * err_buf) { T_CM_DB_EXEC_STAT *p = NULL; char *root_env = NULL; char exec_path[PATH_MAX]; /* cubrid statdump dbname */ const char *argv[] = { exec_path, "statdump", db_name, NULL, }; cm_err_buf_reset (err_buf); if (db_name == NULL) { cm_set_error (err_buf, CM_ERR_NULL_POINTER); return -1; } (void) envvar_bindir_file (exec_path, PATH_MAX, UTIL_CUBRID); p = (T_CM_DB_EXEC_STAT *) cm_get_command_result (argv, extract_db_exec_stat, db_name, err_buf); if (p != NULL) { *exec_stat = *p; FREE_MEM (p); return 0; } return -1; }
CMPIPTV_RTSP::~CMPIPTV_RTSP() { this->logger.Log(LOGGER_INFO, METHOD_START_FORMAT, PROTOCOL_IMPLEMENTATION_NAME, METHOD_DESTRUCTOR_NAME); if (this->IsConnected()) { this->CloseConnection(); } if (this->rtspEnvironment != NULL) { // release RTSP environment this->rtspEnvironment->reclaim(); this->rtspEnvironment = NULL; } if (this->rtspScheduler != NULL) { delete this->rtspScheduler; this->rtspScheduler = NULL; } FREE_MEM(this->rtspUrl); this->logger.Log(LOGGER_INFO, METHOD_END_FORMAT, PROTOCOL_IMPLEMENTATION_NAME, METHOD_DESTRUCTOR_NAME); }
NDIS_STATUS VNic11JoinCompleteCallback( _In_ PVNIC pVNic, _In_ PVOID pvCtx, _In_ PVOID Data ) { PVNIC_COMPLETION_CTX pCtx = NULL; PORT11_GENERIC_CALLBACK_FUNC JoinCompleteHandler= NULL; NDIS_STATUS ndisStatus = NDIS_STATUS_SUCCESS; MpTrace(COMP_HVL, DBG_NORMAL, ("VNic(%d): Hw completed Join operation \n", VNIC_PORT_NO)); pCtx = (PVNIC_COMPLETION_CTX)pvCtx; ASSERT(pCtx); JoinCompleteHandler = pCtx->CompletionFn; FREE_MEM(pCtx); VNicLock(pVNic); ndisStatus = VNicJoinComplete(pVNic, TRUE, JoinCompleteHandler, Data); VNicUnlock(pVNic); return ndisStatus; }
MPIPTVSOURCE_API int SetAndCheckSocketOption(CLogger *logger, const TCHAR *protocolName, const TCHAR *functionName, const TCHAR *optionName, SOCKET s, int level, int optname, const char *optval, int optlen) { int result = SetSocketOption(logger, protocolName, functionName, optionName, s, level, optname, optval, optlen); if (result == 0) { // option correctly set, now check it int valLen = optlen; ALLOC_MEM_DEFINE_SET(val, char, optlen, 0); result = (val == NULL) ? E_OUTOFMEMORY : 0; if (result == 0) { result = GetSocketOption(logger, protocolName, functionName, optionName, s, level, optname, val, &valLen); if (result == 0) { // successfully retrieved value if (optlen == valLen) { result = (memcmp(optval, val, optlen) == 0) ? 0 : (-1); } } } FREE_MEM(val); }
int main(int argc, char* argv[]) { std::cout << engine_info() << std::endl; #ifndef BENCH SETUP_PRIVILEGES(); #endif UCI::init(Options); TT.resize(Options["Hash"]); PSQT::init(); Bitboards::init(); Position::init(); Bitbases::init(); Search::init(); Eval::init(); Pawns::init(); Threads.init(); Tablebases::init(Options["SyzygyPath"]); UCI::loop(argc, argv); if (large_use) { FREE_MEM(TT.mem); TT.mem = nullptr; } Threads.exit(); }
celix_status_t etcdWriter_deletePublisherEndpoint(etcd_writer_pt writer, pubsub_endpoint_pt pubEP) { celix_status_t status = CELIX_SUCCESS; char *key = NULL; const char *rootPath = etcdWriter_getRootPath(writer->pubsub_discovery->context); asprintf(&key, "%s/%s/%s/%s/%ld", rootPath, pubEP->scope, pubEP->topic, pubEP->frameworkUUID, pubEP->serviceID); celixThreadMutex_lock(&writer->localPubsLock); for (unsigned int i = 0; i < arrayList_size(writer->localPubs); i++) { pubsub_endpoint_pt ep = arrayList_get(writer->localPubs, i); if (pubsubEndpoint_equals(ep, pubEP)) { arrayList_remove(writer->localPubs, i); pubsubEndpoint_destroy(ep); break; } } celixThreadMutex_unlock(&writer->localPubsLock); if (etcd_del(key)) { printf("Failed to remove key %s from ETCD\n",key); status = CELIX_ILLEGAL_ARGUMENT; } FREE_MEM(key); return status; }
int hm_req_get_from_pool (T_CON_HANDLE * con, T_REQ_HANDLE ** req, char *sql) { int req_id; void *data; data = cci_mht_rem (con->stmt_pool, sql, true, false); if (data == NULL) { return CCI_ER_REQ_HANDLE; } req_id = *((int *) data); FREE_MEM (data); hm_pool_move_node_from_lru_to_use (con, req_id); if (req != NULL) { *req = con->req_handle_table[GET_REQ_ID (req_id) - 1]; if (*req == NULL) { return CCI_ER_REQ_HANDLE; } } return req_id; }
// virtual void LLImageBase::deleteData() { FREE_MEM(sPrivatePoolp, mData) ; disclaimMem(mDataSize); mDataSize = 0; mData = NULL; }
T_CON_HANDLE * hm_con_handle_alloc (char *ip_str, int port, char *db_name, char *db_user, char *db_passwd) { int handle_id; int error = 0; T_CON_HANDLE *con_handle = NULL; handle_id = new_con_handle_id (); if (handle_id <= 0) { goto error_end; } con_handle = (T_CON_HANDLE *) MALLOC (sizeof (T_CON_HANDLE)); if (con_handle == NULL) { goto error_end; } error = init_con_handle (con_handle, ip_str, port, db_name, db_user, db_passwd); if (error < 0) { goto error_end; } con_handle_table[handle_id - 1] = con_handle; con_handle->id = handle_id; return con_handle; error_end: FREE_MEM (con_handle); return NULL; }
//static U8* LLVFile::readFile(LLVFS *vfs, LLPrivateMemoryPool* poolp, const LLUUID &uuid, LLAssetType::EType type, S32* bytes_read) { U8 *data; LLVFile file(vfs, uuid, type, LLVFile::READ); S32 file_size = file.getSize(); if (file_size == 0) { // File is empty. data = NULL; } else { data = (U8*)ALLOCATE_MEM(poolp, file_size); file.read(data, file_size); /* Flawfinder: ignore */ if (file.getLastBytesRead() != (S32)file_size) { FREE_MEM(poolp, data); data = NULL; file_size = 0; } } if (bytes_read) { *bytes_read = file_size; } return data; }
void TranspositionTable::resize(size_t mbSize) { size_t newClusterCount = size_t(1) << msb((mbSize * 1024 * 1024) / sizeof(Cluster)); if (newClusterCount == clusterCount) return; clusterCount = newClusterCount; mem = nullptr; FREE_MEM(mem); CREATE_MEM2(&mem, clusterCount * sizeof(Cluster)); large_use = true; if (!mem) { free(mem); mem = calloc(clusterCount * sizeof(Cluster) + CacheLineSize - 1, 1); large_use = false; } if (!mem) { std::cerr << "Failed to allocate " << mbSize << "MB for transposition table." << std::endl; exit(EXIT_FAILURE); } table = (Cluster*)((uintptr_t(mem) + CacheLineSize - 1) & ~(CacheLineSize - 1)); }
void req_handle_col_info_free (T_REQ_HANDLE * req_handle) { int i; if (req_handle->col_info) { for (i = 0; i < req_handle->num_col_info; i++) { FREE_MEM (req_handle->col_info[i].col_name); FREE_MEM (req_handle->col_info[i].real_attr); FREE_MEM (req_handle->col_info[i].class_name); FREE_MEM (req_handle->col_info[i].default_value); } FREE_MEM (req_handle->col_info); } }
void my_free(void *p_addr) { mem_mgr_free_param_t para = {0}; para.id = MEM_SYS_PARTITION; para.p_addr = p_addr; FREE_MEM(¶); //free(p_addr); }
void CMPIPTV_RTSP::LogRtspMessage(unsigned int loggerLevel, const TCHAR* messagePrefix) { char *lastRtspMessage = this->GetLastRtspMessageA(); this->LogFullRtspMessage(loggerLevel, messagePrefix, lastRtspMessage); FREE_MEM(lastRtspMessage); }
void cm_broker_proc_stat_all_free (T_CM_BROKER_PROC_STAT_ALL * stat) { int i; if (stat == NULL) return; if (stat->br_stats != NULL) { for (i = 0; i < stat->num_stat; i++) { cm_broker_proc_stat_free (stat->br_stats[i]); } FREE_MEM (stat->br_stats); } FREE_MEM (stat); }
void hm_req_handle_free (T_CON_HANDLE * con_handle, T_REQ_HANDLE * req_handle) { con_handle->req_handle_table[req_handle->req_handle_index - 1] = NULL; --(con_handle->req_handle_count); req_handle_content_free (req_handle, 0); FREE_MEM (req_handle); }