Changeset 148 for trunk/lib/regfi.c


Ignore:
Timestamp:
02/22/09 18:22:59 (15 years ago)
Author:
tim
Message:

integrated talloc into range_list

fixed some uninitialized structure values in the winsec library

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/regfi.c

    r147 r148  
    343343      {
    344344        ret_val = tmp_val;
    345         size += snprintf(ret_val+size, extra, "%s%s%c%s%c%s%c%s",
    346                          ace_delim,sid_str,
    347                          field_delim,type_str,
    348                          field_delim,perms_str,
    349                          field_delim,flags_str);
     345        size += sprintf(ret_val+size, "%s%s%c%s%c%s%c%s",
     346                        ace_delim,sid_str,
     347                        field_delim,type_str,
     348                        field_delim,perms_str,
     349                        field_delim,flags_str);
    350350        ace_delim = "|";
    351351      }
     
    12791279  {
    12801280    rla = range_list_add(rb->hbins, hbin->file_off, hbin->block_size, hbin);
     1281    if(rla)
     1282      talloc_steal(rb->hbins, hbin);
    12811283    hbin_off = hbin->file_off + hbin->block_size;
    12821284    hbin = regfi_parse_hbin(rb, hbin_off, true);
    12831285  }
    1284 
    12851286
    12861287  /* This secret isn't very secret, but we don't need a good one.  This
     
    13011302
    13021303
    1303 /*******************************************************************
    1304  *******************************************************************/
     1304/******************************************************************************
     1305 ******************************************************************************/
    13051306int regfi_close(REGFI_FILE *file)
    13061307{
    13071308  int fd;
    1308   uint32 i;
    13091309
    13101310  /* nothing to do if there is no open file */
     
    13141314  fd = file->fd;
    13151315  file->fd = -1;
    1316   for(i=0; i < range_list_size(file->hbins); i++)
    1317     free(range_list_get(file->hbins, i)->data);
     1316
    13181317  range_list_free(file->hbins);
    13191318
    1320  
    13211319  if(file->sk_cache != NULL)
    13221320    lru_cache_destroy(file->sk_cache);
     1321
    13231322  free(file);
    1324 
    13251323  return close(fd);
    13261324}
     
    13301328 * There should be only *one* root key in the registry file based
    13311329 * on my experience.  --jerry
    1332  *****************************************************************************/
     1330 ******************************************************************************/
    13331331REGFI_NK_REC* regfi_rootkey(REGFI_FILE *file)
    13341332{
     
    17911789
    17921790
    1793 /*******************************************************************
     1791/******************************************************************************
    17941792 * Given real file offset, read and parse the hbin at that location
    17951793 * along with it's associated cells.
    1796  *******************************************************************/
    1797 /* XXX: Need a way to return types of errors.
    1798  */
     1794 ******************************************************************************/
    17991795REGFI_HBIN* regfi_parse_hbin(REGFI_FILE* file, uint32 offset, bool strict)
    18001796{
     
    18251821  }
    18261822
    1827   if(!(hbin = (REGFI_HBIN*)zalloc(sizeof(REGFI_HBIN))))
     1823  hbin = talloc(NULL, REGFI_HBIN);
     1824  if(hbin == NULL)
    18281825    return NULL;
    18291826  hbin->file_off = offset;
     
    18361833                      " 0x%.8X.", hbin->magic[0], hbin->magic[1],
    18371834                      hbin->magic[2], hbin->magic[3], offset);
    1838     free(hbin);
     1835    talloc_free(hbin);
    18391836    return NULL;
    18401837  }
     
    18581855                      " or runs off the end of the file"
    18591856                      " while parsing hbin at offset 0x%.8X.", offset);
    1860     free(hbin);
     1857    talloc_free(hbin);
    18611858    return NULL;
    18621859  }
Note: See TracChangeset for help on using the changeset viewer.