Changeset 184 for trunk/src


Ignore:
Timestamp:
03/20/10 13:50:44 (15 years ago)
Author:
tim
Message:

redesigned memory management to allow for multiple references to talloc-ed objects

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/common.c

    r182 r184  
    163163 * value, and a non-NULL (*error_msg).
    164164 */
    165 static char* data_to_ascii(REGFI_DATA* data, char** error_msg)
     165static char* data_to_ascii(const REGFI_DATA* data, char** error_msg)
    166166{
    167167  char* ret_val;
  • trunk/src/reglookup-recover.c

    r182 r184  
    291291        {
    292292          /* XXX: Need to add a warning here */
    293           regfi_free_key(cur_ancestor);
     293          regfi_free_record(cur_ancestor);
    294294          void_stack_free(path_stack);
    295295          return NULL;
     
    303303        ret_val_size += path_element->len + 1;
    304304
    305         regfi_free_key(cur_ancestor);
     305        regfi_free_record(cur_ancestor);
    306306      }
    307307    }
     
    631631
    632632 fail:
    633   regfi_free_key(key);
     633  regfi_free_record(key);
    634634  return error_code;
    635635}
  • trunk/src/reglookup.c

    r182 r184  
    5454void printValue(REGFI_ITERATOR* iter, const REGFI_VK_REC* vk, char* prefix)
    5555{
    56   REGFI_DATA* data;
     56  const REGFI_DATA* data;
    5757  char* quoted_value = NULL;
    5858  char* quoted_name = NULL;
     
    9595      fprintf(stderr, "WARN: While quoting value for '%s/%s', "
    9696              "warning returned: %s\n", prefix, quoted_name, conv_error);
    97     regfi_free_data(data);
     97    regfi_free_record(data);
    9898  }
    9999
     
    275275void printValueList(REGFI_ITERATOR* iter, char* prefix)
    276276{
    277   REGFI_VK_REC* value;
     277  const REGFI_VK_REC* value;
    278278
    279279  value = regfi_iterator_first_value(iter);
     
    282282    if(!type_filter_enabled || (value->type == type_filter))
    283283      printValue(iter, value, prefix);
    284     regfi_free_value(value);
     284    regfi_free_record(value);
    285285    value = regfi_iterator_next_value(iter);
    286286    printMsgs(iter->f);
     
    299299  char* quoted_classname;
    300300  const REGFI_SK_REC* sk;
    301   const REGFI_NK_REC* k = regfi_iterator_cur_key(iter);
    302   REGFI_CLASSNAME* classname;
    303 
    304   formatTime(&k->mtime, mtime);
     301  const REGFI_NK_REC* key = regfi_iterator_cur_key(iter);
     302  const REGFI_CLASSNAME* classname;
     303
     304  formatTime(&key->mtime, mtime);
    305305
    306306  if(print_security && (sk=regfi_iterator_cur_sk(iter)))
     
    310310    sacl = regfi_get_sacl(sk->sec_desc);
    311311    dacl = regfi_get_dacl(sk->sec_desc);
     312    regfi_free_record(sk);
     313
    312314    if(owner == NULL)
    313315      owner = empty_str;
     
    319321      dacl = empty_str;
    320322
    321     classname = regfi_iterator_fetch_classname(iter, k);
     323    classname = regfi_iterator_fetch_classname(iter, key);
    322324    printMsgs(iter->f);
    323325    if(classname != NULL)
     
    343345    else
    344346      quoted_classname = empty_str;
    345     regfi_free_classname(classname);
     347    regfi_free_record(classname);
    346348
    347349    printMsgs(iter->f);
     
    362364  else
    363365    printf("%s,KEY,,%s\n", full_path, mtime);
     366
     367  regfi_free_record(key);
    364368}
    365369
     
    369373  const REGFI_NK_REC* root = NULL;
    370374  const REGFI_NK_REC* cur = NULL;
    371   REGFI_NK_REC* sub = NULL;
     375  const REGFI_NK_REC* sub = NULL;
    372376  char* path = NULL;
    373377  int key_type = regfi_type_str2val("KEY");
     
    430434
    431435      cur = regfi_iterator_cur_key(iter);
    432       regfi_free_key(sub);
     436      regfi_free_record(sub);
    433437      sub = regfi_iterator_first_subkey(iter);
    434438      print_this = true;
     
    453457int retrievePath(REGFI_ITERATOR* iter, char** path)
    454458{
    455   REGFI_VK_REC* value;
     459  const REGFI_VK_REC* value;
    456460  char* tmp_path_joined;
    457461  const char** tmp_path;
     
    508512      printValue(iter, value, tmp_path_joined);
    509513
    510     regfi_free_value(value);
     514    regfi_free_record(value);
    511515    free(tmp_path);
    512516    free(tmp_path_joined);
Note: See TracChangeset for help on using the changeset viewer.