- Timestamp:
- 03/01/09 21:17:46 (16 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/reglookup-recover.c
r149 r150 15 15 * You should have received a copy of the GNU General Public License 16 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 18 * 19 19 * $Id$ … … 84 84 quoted_name = malloc(1*sizeof(char)); 85 85 if(quoted_name == NULL) 86 bailOut(REGLOOKUP_EXIT_OSERR, "ERROR: Could not allocate sufficient memory.\n"); 86 bailOut(REGLOOKUP_EXIT_OSERR, 87 "ERROR: Could not allocate sufficient memory.\n"); 87 88 quoted_name[0] = '\0'; 88 89 … … 297 298 virt_offset = cur_ancestor->parent_off; 298 299 299 path_element = (struct name_holder*)malloc(sizeof(struct name_holder));300 path_element = talloc(path_stack, struct name_holder); 300 301 if(path_element != NULL) 301 302 path_element->quoted_name = quote_string(cur_ancestor->keyname, … … 305 306 || !void_stack_push(path_stack, path_element)) 306 307 { 307 free(cur_ancestor->keyname);308 free(cur_ancestor);309 void_stack_free _deep(path_stack);308 /* XXX: Need to add a warning here */ 309 regfi_free_key(cur_ancestor); 310 void_stack_free(path_stack); 310 311 return NULL; 311 312 } … … 318 319 ret_val_size += path_element->length + 1; 319 320 320 regfi_ key_free(cur_ancestor);321 regfi_free_key(cur_ancestor); 321 322 } 322 323 } … … 328 329 if(ret_val == NULL) 329 330 { 330 void_stack_free _deep(path_stack);331 void_stack_free(path_stack); 331 332 return NULL; 332 333 } … … 340 341 ret_val_used += path_element->length + 1; 341 342 free(path_element->quoted_name); 342 free(path_element);343 talloc_free(path_element); 343 344 } 344 345 void_stack_free(path_stack); … … 532 533 REGFI_NK_REC* key; 533 534 uint32 i, j; 535 int error_code = 0; 534 536 535 537 for(i=0; i < range_list_size(unalloc_cells); i++) … … 550 552 { 551 553 fprintf(stderr, "ERROR: Couldn't add key to unalloc_keys.\n"); 552 return 20; 554 error_code = 20; 555 goto fail; 553 556 } 557 talloc_steal(unalloc_keys, key); 554 558 j+=key->cell_size-8; 555 559 } … … 561 565 cur_elem = range_list_get(unalloc_keys, i); 562 566 if(!removeRange(unalloc_cells, cur_elem->offset, cur_elem->length)) 563 return 30; 567 { 568 error_code = 30; 569 goto fail; 570 } 564 571 } 565 572 566 573 return 0; 574 575 fail: 576 regfi_free_key(key); 577 return error_code; 567 578 } 568 579 … … 611 622 * so prune it. 612 623 */ 613 free(nk->values->elements); 614 free(nk->values); 624 talloc_free(nk->values); 615 625 nk->values = NULL; 616 626 } … … 639 649 vk->cell_size, vk)) 640 650 { 641 free(vk);651 talloc_free(vk); 642 652 return 30; 643 653 } … … 647 657 } 648 658 else 649 free(vk);659 talloc_free(vk); 650 660 } 651 661 } -
trunk/src/reglookup.c
r147 r150 275 275 void printValueList(REGFI_ITERATOR* iter, char* prefix) 276 276 { 277 constREGFI_VK_REC* value;277 REGFI_VK_REC* value; 278 278 279 279 value = regfi_iterator_first_value(iter); … … 282 282 if(!type_filter_enabled || (value->type == type_filter)) 283 283 printValue(value, prefix); 284 regfi_free_value(value); 284 285 value = regfi_iterator_next_value(iter); 285 286 printMsgs(iter->f); … … 373 374 const REGFI_NK_REC* root = NULL; 374 375 const REGFI_NK_REC* cur = NULL; 375 constREGFI_NK_REC* sub = NULL;376 REGFI_NK_REC* sub = NULL; 376 377 char* path = NULL; 377 378 int key_type = regfi_type_str2val("KEY"); … … 418 419 bailOut(REGLOOKUP_EXIT_DATAERR, "ERROR: unexpected NULL for key.\n"); 419 420 } 420 421 421 422 sub = regfi_iterator_next_subkey(iter); 422 423 } … … 433 434 } 434 435 435 cur = sub; 436 cur = regfi_iterator_cur_key(iter); 437 regfi_free_key(sub); 436 438 sub = regfi_iterator_first_subkey(iter); 437 439 print_this = true; … … 456 458 int retrievePath(REGFI_ITERATOR* iter, char** path) 457 459 { 458 constREGFI_VK_REC* value;460 REGFI_VK_REC* value; 459 461 char* tmp_path_joined; 460 462 const char** tmp_path; … … 511 513 printValue(value, tmp_path_joined); 512 514 515 regfi_free_value(value); 513 516 free(tmp_path); 514 517 free(tmp_path_joined);
Note: See TracChangeset
for help on using the changeset viewer.