您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ yr_free函数代码示例

51自学网 2021-06-03 11:54:56
  C++
这篇教程C++ yr_free函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中yr_free函数的典型用法代码示例。如果您正苦于以下问题:C++ yr_free函数的具体用法?C++ yr_free怎么用?C++ yr_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了yr_free函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: yr_ac_automaton_create

int yr_ac_automaton_create(    YR_AC_AUTOMATON** automaton){  YR_AC_AUTOMATON* new_automaton;  YR_AC_STATE* root_state;  new_automaton = (YR_AC_AUTOMATON*) yr_malloc(sizeof(YR_AC_AUTOMATON));  root_state = (YR_AC_STATE*) yr_malloc(sizeof(YR_AC_STATE));  if (new_automaton == NULL || root_state == NULL)  {    yr_free(new_automaton);    yr_free(root_state);    return ERROR_INSUFFICIENT_MEMORY;  }  root_state->depth = 0;  root_state->matches = NULL;  root_state->failure = NULL;  root_state->first_child = NULL;  root_state->siblings = NULL;  root_state->t_table_slot = 0;  new_automaton->root = root_state;  new_automaton->m_table = NULL;  new_automaton->t_table = NULL;  new_automaton->tables_size = 0;  *automaton = new_automaton;  return ERROR_SUCCESS;}
开发者ID:nugxperience,项目名称:yara,代码行数:33,


示例2: yr_re_finalize_thread

int yr_re_finalize_thread(void){  RE_FIBER* fiber;  RE_FIBER* next_fiber;  RE_THREAD_STORAGE* storage;  if (thread_storage_key != 0)    storage = (RE_THREAD_STORAGE*) yr_thread_storage_get_value(        &thread_storage_key);  else    return ERROR_SUCCESS;  if (storage != NULL)  {    fiber = storage->fiber_pool.fibers.head;    while (fiber != NULL)    {      next_fiber = fiber->next;      yr_free(fiber);      fiber = next_fiber;    }    yr_free(storage);  }  return yr_thread_storage_set_value(&thread_storage_key, NULL);}
开发者ID:ewil,项目名称:yara,代码行数:28,


示例3: yr_arena_destroy

void yr_arena_destroy(    YR_ARENA* arena){  YR_RELOC* reloc;  YR_RELOC* next_reloc;  YR_ARENA_PAGE* page;  YR_ARENA_PAGE* next_page;  if (arena == NULL)    return;  page = arena->page_list_head;  while(page != NULL)  {    next_page = page->next;    reloc = page->reloc_list_head;    while (reloc != NULL)    {      next_reloc = reloc->next;      yr_free(reloc);      reloc = next_reloc;    }    yr_free(page->address);    yr_free(page);    page = next_page;  }  yr_free(arena);}
开发者ID:msuvajac,项目名称:yara,代码行数:33,


示例4: yr_hash_table_clean

YR_API void yr_hash_table_clean(    YR_HASH_TABLE* table,    YR_HASH_TABLE_FREE_VALUE_FUNC free_value){  YR_HASH_TABLE_ENTRY* entry;  YR_HASH_TABLE_ENTRY* next_entry;  int i;  if (table == NULL)    return;  for (i = 0; i < table->size; i++)  {    entry = table->buckets[i];    while (entry != NULL)    {      next_entry = entry->next;      if (free_value != NULL)        free_value(entry->value);      if (entry->ns != NULL)        yr_free(entry->ns);      yr_free(entry->key);      yr_free(entry);      entry = next_entry;    }    table->buckets[i] = NULL;  }}
开发者ID:TidyHuang,项目名称:yara,代码行数:35,


示例5: yr_rules_destroy

int yr_rules_destroy(    YR_RULES* rules){  YR_EXTERNAL_VARIABLE* external;  external = rules->externals_list_head;  while (!EXTERNAL_VARIABLE_IS_NULL(external))  {    if (external->type == EXTERNAL_VARIABLE_TYPE_MALLOC_STRING)      yr_free(external->string);    external++;  }  #if WIN32  CloseHandle(rules->mutex);  #else  pthread_mutex_destroy(&rules->mutex);  #endif  yr_arena_destroy(rules->arena);  yr_free(rules);  return ERROR_SUCCESS;}
开发者ID:dodng,项目名称:yara,代码行数:26,


示例6: yr_re_finalize_thread

int yr_re_finalize_thread(){  RE_FIBER* fiber;  RE_FIBER* next_fiber;  RE_THREAD_STORAGE* storage;  #ifdef WIN32  storage = TlsGetValue(thread_storage_key);  #else  storage = pthread_getspecific(thread_storage_key);  #endif  if (storage != NULL)  {    fiber = storage->fiber_pool.head;    while (fiber != NULL)    {      next_fiber = fiber->next;      yr_free(fiber);      fiber = next_fiber;    }    yr_free(storage);  }  return ERROR_SUCCESS;}
开发者ID:devilcoder,项目名称:yara,代码行数:28,


示例7: yr_hash_table_destroy

void yr_hash_table_destroy(    YR_HASH_TABLE* table){  YR_HASH_TABLE_ENTRY* entry;  YR_HASH_TABLE_ENTRY* next_entry;  int i;  for (i = 0; i < table->size; i++)  {    entry = table->buckets[i];    while (entry != NULL)    {      next_entry = entry->next;      if (entry->ns != NULL)        yr_free(entry->ns);      yr_free(entry->key);      yr_free(entry);      entry = next_entry;    }  }  yr_free(table);}
开发者ID:bushido,项目名称:yara,代码行数:25,


示例8: yr_hash_table_add_raw_key

YR_API int yr_hash_table_add_raw_key(    YR_HASH_TABLE* table,    const void* key,    size_t key_length,    const char* ns,    void* value){  YR_HASH_TABLE_ENTRY* entry;  uint32_t bucket_index;  entry = (YR_HASH_TABLE_ENTRY*) yr_malloc(sizeof(YR_HASH_TABLE_ENTRY));  if (entry == NULL)    return ERROR_INSUFICIENT_MEMORY;  entry->key = yr_malloc(key_length);  if (entry->key == NULL)  {    yr_free(entry);    return ERROR_INSUFICIENT_MEMORY;  }  if (ns != NULL)  {    entry->ns = yr_strdup(ns);    if (entry->ns == NULL)    {      yr_free(entry->key);      yr_free(entry);      return ERROR_INSUFICIENT_MEMORY;    }  }  else  {    entry->ns = NULL;  }  entry->key_length = key_length;  entry->value = value;  memcpy(entry->key, key, key_length);  bucket_index = hash(0, key, key_length);  if (ns != NULL)    bucket_index = hash(bucket_index, (uint8_t*) ns, strlen(ns));  bucket_index = bucket_index % table->size;  entry->next = table->buckets[bucket_index];  table->buckets[bucket_index] = entry;  return ERROR_SUCCESS;}
开发者ID:TidyHuang,项目名称:yara,代码行数:57,


示例9: yr_object_destroy

void yr_object_destroy(    YR_OBJECT* object){  YR_STRUCTURE_MEMBER* member;  YR_STRUCTURE_MEMBER* next_member;  YR_ARRAY_ITEMS* array_items;  RE* re;  int i;  char* str;  switch(object->type)  {    case OBJECT_TYPE_STRUCTURE:      member = ((YR_OBJECT_STRUCTURE*) object)->members;      while (member != NULL)      {        next_member = member->next;        yr_object_destroy(member->object);        yr_free(member);        member = next_member;      }      break;    case OBJECT_TYPE_STRING:      str = ((YR_OBJECT_STRING*) object)->value;      if (str != NULL)        yr_free(str);      break;    case OBJECT_TYPE_REGEXP:      re = ((YR_OBJECT_REGEXP*) object)->value;      if (re != NULL)        yr_re_destroy(re);      break;    case OBJECT_TYPE_ARRAY:      array_items = ((YR_OBJECT_ARRAY*) object)->items;      for (i = 0; i < array_items->count; i++)        if (array_items->objects[i] != NULL)          yr_object_destroy(array_items->objects[i]);      yr_free(array_items);      break;    case OBJECT_TYPE_FUNCTION:      yr_object_destroy(((YR_OBJECT_FUNCTION*) object)->return_obj);      break;  }  yr_free((void*) object->identifier);  yr_free(object);}
开发者ID:nonmoun,项目名称:yara,代码行数:55,


示例10: yr_re_destroy

void yr_re_destroy(  RE* re){  if (re->root_node != NULL)    yr_re_node_destroy(re->root_node);  if (re->error_message != NULL)    yr_free((char*) re->error_message);  yr_free(re);}
开发者ID:devilcoder,项目名称:yara,代码行数:11,


示例11: yr_ac_automaton_destroy

int yr_ac_automaton_destroy(    YR_AC_AUTOMATON* automaton){  _yr_ac_state_destroy(automaton->root);  yr_free(automaton->t_table);  yr_free(automaton->m_table);  yr_free(automaton);  return ERROR_SUCCESS;}
开发者ID:nugxperience,项目名称:yara,代码行数:11,


示例12: yr_re_node_destroy

void yr_re_node_destroy(  RE_NODE* node){  if (node->left != NULL)    yr_re_node_destroy(node->left);  if (node->right != NULL)    yr_re_node_destroy(node->right);  if (node->type == RE_NODE_CLASS)    yr_free(node->class_vector);  yr_free(node);}
开发者ID:devilcoder,项目名称:yara,代码行数:14,


示例13: yr_compiler_destroy

void yr_compiler_destroy(    YR_COMPILER* compiler){  int i;  if (compiler->compiled_rules_arena != NULL)    yr_arena_destroy(compiler->compiled_rules_arena);  if (compiler->sz_arena != NULL)    yr_arena_destroy(compiler->sz_arena);  if (compiler->rules_arena != NULL)    yr_arena_destroy(compiler->rules_arena);  if (compiler->strings_arena != NULL)    yr_arena_destroy(compiler->strings_arena);  if (compiler->code_arena != NULL)    yr_arena_destroy(compiler->code_arena);  if (compiler->re_code_arena != NULL)    yr_arena_destroy(compiler->re_code_arena);  if (compiler->automaton_arena != NULL)    yr_arena_destroy(compiler->automaton_arena);  if (compiler->externals_arena != NULL)    yr_arena_destroy(compiler->externals_arena);  if (compiler->namespaces_arena != NULL)    yr_arena_destroy(compiler->namespaces_arena);  if (compiler->metas_arena != NULL)    yr_arena_destroy(compiler->metas_arena);  yr_hash_table_destroy(      compiler->rules_table,      NULL);  yr_hash_table_destroy(      compiler->objects_table,      (YR_HASH_TABLE_FREE_VALUE_FUNC) yr_object_destroy);  for (i = 0; i < compiler->file_name_stack_ptr; i++)    yr_free(compiler->file_name_stack[i]);  yr_free(compiler);}
开发者ID:nonmoun,项目名称:yara,代码行数:48,


示例14: _yr_arena_new_page

YR_ARENA_PAGE* _yr_arena_new_page(    size_t size){  YR_ARENA_PAGE* new_page;  new_page = (YR_ARENA_PAGE*) yr_malloc(sizeof(YR_ARENA_PAGE));  if (new_page == NULL)    return NULL;  new_page->address = (uint8_t*) yr_malloc(size);  if (new_page->address == NULL)  {    yr_free(new_page);    return NULL;  }  new_page->size = size;  new_page->used = 0;  new_page->next = NULL;  new_page->prev = NULL;  new_page->reloc_list_head = NULL;  new_page->reloc_list_tail = NULL;  return new_page;}
开发者ID:msuvajac,项目名称:yara,代码行数:27,


示例15: _yr_fetch_block_data

uint8_t* _yr_fetch_block_data(    YR_MEMORY_BLOCK* block){  YR_PROC_ITERATOR_CTX* context = (YR_PROC_ITERATOR_CTX*) block->context;  if (context->buffer_size < block->size)  {    if (context->buffer != NULL)      yr_free(context->buffer);    context->buffer = yr_malloc(block->size);    if (context->buffer != NULL)    {      context->buffer_size = block->size;    }    else    {      context->buffer_size = 0;      return NULL;    }  }  if (pread(context->mem_fd,            context->buffer,            block->size,            block->base) == -1)  {    return NULL;  }  return context->buffer;}
开发者ID:nugxperience,项目名称:yara,代码行数:33,


示例16: yr_arena_append

int yr_arena_append(    YR_ARENA* target_arena,    YR_ARENA* source_arena){  uint8_t padding_data[15];  size_t padding_size = 16 - target_arena->current_page->used % 16;  if (padding_size < 16)  {    memset(&padding_data, 0xCC, padding_size);    FAIL_ON_ERROR(yr_arena_write_data(        target_arena,        padding_data,        padding_size,        NULL));  }  target_arena->current_page->next = source_arena->page_list_head;  source_arena->page_list_head->prev = target_arena->current_page;  target_arena->current_page = source_arena->current_page;  yr_free(source_arena);  return ERROR_SUCCESS;}
开发者ID:msuvajac,项目名称:yara,代码行数:26,


示例17: yr_hash_table_destroy

YR_API void yr_hash_table_destroy(    YR_HASH_TABLE* table,    YR_HASH_TABLE_FREE_VALUE_FUNC free_value){  yr_hash_table_clean(table, free_value);  yr_free(table);}
开发者ID:TidyHuang,项目名称:yara,代码行数:7,


示例18: yr_rules_define_string_variable

int yr_rules_define_string_variable(    YR_RULES* rules,    const char* identifier,    const char* value){  YR_EXTERNAL_VARIABLE* external;  external = rules->externals_list_head;  while (!EXTERNAL_VARIABLE_IS_NULL(external))  {    if (strcmp(external->identifier, identifier) == 0)    {      if (external->type == EXTERNAL_VARIABLE_TYPE_MALLOC_STRING &&          external->string != NULL)      {        yr_free(external->string);      }      external->type = EXTERNAL_VARIABLE_TYPE_MALLOC_STRING;      external->string = yr_strdup(value);      if (external->string == NULL)        return ERROR_INSUFICIENT_MEMORY;      else        return ERROR_SUCCESS;    }    external++;  }  return ERROR_SUCCESS;}
开发者ID:dodng,项目名称:yara,代码行数:33,


示例19: yr_process_fetch_memory_block_data

YR_API const uint8_t* yr_process_fetch_memory_block_data(    YR_MEMORY_BLOCK* block){  YR_PROC_ITERATOR_CTX* context = (YR_PROC_ITERATOR_CTX*) block->context;  YR_PROC_INFO* proc_info = (YR_PROC_INFO*) context->proc_info;  if (context->buffer_size < block->size)  {    if (context->buffer != NULL)      yr_free((void*) context->buffer);    context->buffer = (const uint8_t*) yr_malloc(block->size);    if (context->buffer != NULL)    {      context->buffer_size = block->size;    }    else    {      context->buffer_size = 0;      return NULL;    }  }  if (pread(proc_info->mem_fd,            (void *) context->buffer,            block->size,            block->base) == -1)  {    return NULL;  }  return context->buffer;}
开发者ID:elmelik,项目名称:yara,代码行数:34,


示例20: yr_arena_create

int yr_arena_create(    size_t initial_size,    int flags,    YR_ARENA** arena){  YR_ARENA* new_arena;  YR_ARENA_PAGE* new_page;  *arena = NULL;  new_arena = (YR_ARENA*) yr_malloc(sizeof(YR_ARENA));  if (new_arena == NULL)    return ERROR_INSUFFICIENT_MEMORY;  new_page = _yr_arena_new_page(initial_size);  if (new_page == NULL)  {    yr_free(new_arena);    return ERROR_INSUFFICIENT_MEMORY;  }  new_arena->page_list_head = new_page;  new_arena->current_page = new_page;  new_arena->flags = flags | ARENA_FLAGS_COALESCED;  *arena = new_arena;  return ERROR_SUCCESS;}
开发者ID:msuvajac,项目名称:yara,代码行数:29,


示例21: yr_compiler_destroy

YR_API void yr_compiler_destroy(    YR_COMPILER* compiler){  YR_FIXUP* fixup;  int i;  yr_arena_destroy(compiler->compiled_rules_arena);  yr_arena_destroy(compiler->sz_arena);  yr_arena_destroy(compiler->rules_arena);  yr_arena_destroy(compiler->strings_arena);  yr_arena_destroy(compiler->code_arena);  yr_arena_destroy(compiler->re_code_arena);  yr_arena_destroy(compiler->externals_arena);  yr_arena_destroy(compiler->namespaces_arena);  yr_arena_destroy(compiler->metas_arena);  yr_arena_destroy(compiler->automaton_arena);  yr_arena_destroy(compiler->matches_arena);    yr_ac_automaton_destroy(compiler->automaton);  yr_hash_table_destroy(      compiler->rules_table,      NULL);  yr_hash_table_destroy(      compiler->strings_table,      NULL);  yr_hash_table_destroy(      compiler->objects_table,      (YR_HASH_TABLE_FREE_VALUE_FUNC) yr_object_destroy);  for (i = 0; i < compiler->file_name_stack_ptr; i++)    yr_free(compiler->file_name_stack[i]);  fixup = compiler->fixup_stack_head;  while (fixup != NULL)  {    YR_FIXUP* next_fixup = fixup->next;    yr_free(fixup);    fixup = next_fixup;  }  yr_free(compiler);}
开发者ID:c4nc,项目名称:yara,代码行数:46,


示例22: yr_process_free_memory

int yr_process_free_memory(    YR_MEMORY_BLOCK* first_block){  YR_MEMORY_BLOCK* block;  YR_MEMORY_BLOCK* next_block;  block = first_block;  while (block != NULL)  {    next_block = block->next;    yr_free(block->data);    yr_free(block);    block = next_block;  }  return 0;}
开发者ID:plutec,项目名称:yara,代码行数:18,


示例23: yr_process_close_iterator

int yr_process_close_iterator(    YR_MEMORY_BLOCK_ITERATOR* iterator){  YR_PROC_ITERATOR_CTX* context = (YR_PROC_ITERATOR_CTX*) iterator->context;  if (context != NULL)  {    _yr_process_detach(context);    if (context->buffer != NULL)      yr_free(context->buffer);    yr_free(context);    iterator->context = NULL;  }  return ERROR_SUCCESS;}
开发者ID:nugxperience,项目名称:yara,代码行数:19,


示例24: _yr_compiler_pop_file_name

void _yr_compiler_pop_file_name(    YR_COMPILER* compiler){  if (compiler->file_name_stack_ptr > 0)  {    compiler->file_name_stack_ptr--;    yr_free(compiler->file_name_stack[compiler->file_name_stack_ptr]);    compiler->file_name_stack[compiler->file_name_stack_ptr] = NULL;  }}
开发者ID:c4nc,项目名称:yara,代码行数:10,


示例25: yr_arena_append

int yr_arena_append(    YR_ARENA* target_arena,    YR_ARENA* source_arena){  target_arena->current_page->next = source_arena->page_list_head;  target_arena->current_page = source_arena->current_page;  yr_free(source_arena);  return ERROR_SUCCESS;}
开发者ID:chrisddom,项目名称:yara,代码行数:11,


示例26: yr_re_destroy

void yr_re_destroy(    RE* re){  if (re->root_node != NULL)    yr_re_node_destroy(re->root_node);  if (re->code_arena != NULL)    yr_arena_destroy(re->code_arena);  yr_free(re);}
开发者ID:mikalv,项目名称:yara,代码行数:11,


示例27: yr_rules_scan_proc

int yr_rules_scan_proc(    YR_RULES* rules,    int pid,    YR_CALLBACK_FUNC callback,    void* user_data,    int fast_scan_mode,    int timeout){  YR_MEMORY_BLOCK* first_block;  YR_MEMORY_BLOCK* next_block;  YR_MEMORY_BLOCK* block;  int result;  result = yr_process_get_memory(pid, &first_block);  if (result == ERROR_SUCCESS)    result = yr_rules_scan_mem_blocks(        rules,        first_block,        TRUE,        callback,        user_data,        fast_scan_mode,        timeout);  block = first_block;  while (block != NULL)  {    next_block = block->next;    yr_free(block->data);    yr_free(block);    block = next_block;  }  return result;}
开发者ID:dodng,项目名称:yara,代码行数:40,


示例28: yr_atoms_list_destroy

void yr_atoms_list_destroy(    YR_ATOM_LIST_ITEM* list_head){  YR_ATOM_LIST_ITEM* item = list_head;  YR_ATOM_LIST_ITEM* next;  while (item != NULL)  {    next = item->next;    yr_free(item);    item = next;  }}
开发者ID:rednaga,项目名称:yara,代码行数:13,


示例29: _yr_process_attach

int _yr_process_attach(    int pid,    YR_PROC_ITERATOR_CTX* context){  TOKEN_PRIVILEGES tokenPriv;  LUID luidDebug;  HANDLE hToken = NULL;  YR_PROC_INFO* proc_info = (YR_PROC_INFO*) yr_malloc(sizeof(YR_PROC_INFO));  if (proc_info == NULL)    return ERROR_INSUFFICIENT_MEMORY;  if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken) &&      LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &luidDebug))  {    tokenPriv.PrivilegeCount = 1;    tokenPriv.Privileges[0].Luid = luidDebug;    tokenPriv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;    AdjustTokenPrivileges(        hToken,        FALSE,        &tokenPriv,        sizeof(tokenPriv),        NULL,        NULL);  }  if (hToken != NULL)    CloseHandle(hToken);  proc_info->hProcess = OpenProcess(      PROCESS_VM_READ | PROCESS_QUERY_INFORMATION,      FALSE,      pid);  if (proc_info->hProcess == NULL)  {    yr_free(proc_info);    return ERROR_COULD_NOT_ATTACH_TO_PROCESS;  }  GetSystemInfo(&proc_info->si);  context->proc_info = proc_info;  return ERROR_SUCCESS;}
开发者ID:rednaga,项目名称:yara,代码行数:49,


示例30: _yr_ac_state_destroy

int _yr_ac_state_destroy(    YR_AC_STATE* state){  YR_AC_STATE* child_state = state->first_child;  while (child_state != NULL)  {    YR_AC_STATE* next_child_state = child_state->siblings;    _yr_ac_state_destroy(child_state);    child_state = next_child_state;  }  yr_free(state);  return ERROR_SUCCESS;}
开发者ID:nugxperience,项目名称:yara,代码行数:16,



注:本文中的yr_free函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ yr_malloc函数代码示例
C++ yr_arena_write_data函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。