- Timestamp:
- 03/01/09 21:17:46 (16 years ago)
- Location:
- trunk/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/range_list.c
r148 r150 143 143 void range_list_free(range_list* rl) 144 144 { 145 if(rl == NULL) 146 return; 147 148 talloc_free(rl); 145 if(rl != NULL) 146 talloc_free(rl); 149 147 } 150 148 -
trunk/lib/regfi.c
r148 r150 560 560 { 561 561 num_sublists = ret_val->num_children; 562 sublists = (REGFI_SUBKEY_LIST**) zalloc(num_sublists562 sublists = (REGFI_SUBKEY_LIST**)malloc(num_sublists 563 563 * sizeof(REGFI_SUBKEY_LIST*)); 564 564 for(i=0; i < num_sublists; i++) … … 575 575 } 576 576 } 577 free(ret_val);577 talloc_free(ret_val); 578 578 579 579 return regfi_merge_subkeylists(num_sublists, sublists, strict); … … 590 590 { 591 591 REGFI_SUBKEY_LIST* ret_val; 592 uint32 i, cell_length, length, elem_size ;593 uint8* elements ;592 uint32 i, cell_length, length, elem_size, read_len; 593 uint8* elements = NULL; 594 594 uint8 buf[REGFI_SUBKEY_LIST_MIN_LEN]; 595 595 bool unalloc; … … 631 631 } 632 632 633 ret_val = (REGFI_SUBKEY_LIST*)zalloc(sizeof(REGFI_SUBKEY_LIST));633 ret_val = talloc(NULL, REGFI_SUBKEY_LIST); 634 634 if(ret_val == NULL) 635 635 return NULL; … … 652 652 offset); 653 653 if(strict) 654 { 655 free(ret_val); 656 return NULL; 657 } 654 goto fail; 658 655 length = cell_length - REGFI_SUBKEY_LIST_MIN_LEN - sizeof(uint32); 659 656 } 660 657 661 ret_val->elements 662 = (REGFI_SUBKEY_LIST_ELEM*)zalloc(ret_val->num_children 663 * sizeof(REGFI_SUBKEY_LIST_ELEM)); 658 ret_val->elements = talloc_array(ret_val, REGFI_SUBKEY_LIST_ELEM, 659 ret_val->num_children); 664 660 if(ret_val->elements == NULL) 665 { 666 free(ret_val); 667 return NULL; 668 } 669 670 elements = (uint8*)zalloc(length); 661 goto fail; 662 663 elements = (uint8*)malloc(length); 671 664 if(elements == NULL) 672 { 673 free(ret_val->elements); 674 free(ret_val); 675 return NULL; 676 } 677 678 if(regfi_read(file->fd, elements, &length) != 0 679 || length != elem_size*ret_val->num_children) 680 { 681 free(ret_val->elements); 682 free(ret_val); 683 return NULL; 684 } 665 goto fail; 666 667 read_len = length; 668 if(regfi_read(file->fd, elements, &read_len) != 0 || read_len != length) 669 goto fail; 685 670 686 671 if(elem_size == sizeof(uint32)) … … 703 688 704 689 return ret_val; 690 691 fail: 692 if(elements != NULL) 693 free(elements); 694 talloc_free(ret_val); 695 return NULL; 705 696 } 706 697 … … 717 708 if(lists == NULL) 718 709 return NULL; 719 ret_val = (REGFI_SUBKEY_LIST*)zalloc(sizeof(REGFI_SUBKEY_LIST));710 ret_val = talloc(NULL, REGFI_SUBKEY_LIST); 720 711 721 712 if(ret_val == NULL) … … 733 724 if(ret_val->num_keys > 0) 734 725 { 735 ret_val->elements = 736 (REGFI_SUBKEY_LIST_ELEM*)zalloc(sizeof(REGFI_SUBKEY_LIST_ELEM) 737 * ret_val->num_keys); 726 ret_val->elements = talloc_array(ret_val, REGFI_SUBKEY_LIST_ELEM, 727 ret_val->num_keys); 738 728 k=0; 739 729 … … 746 736 for(j=0; j < lists[i]->num_keys; j++) 747 737 { 748 ret_val->elements[k].hash =lists[i]->elements[j].hash;749 ret_val->elements[k++].offset =lists[i]->elements[j].offset;738 ret_val->elements[k].hash = lists[i]->elements[j].hash; 739 ret_val->elements[k++].offset = lists[i]->elements[j].offset; 750 740 } 751 741 } … … 789 779 } 790 780 791 /* ret_val = (REGFI_SK_REC*)zalloc(sizeof(REGFI_SK_REC));*/792 781 ret_val = talloc(NULL, REGFI_SK_REC); 793 782 if(ret_val == NULL) … … 903 892 904 893 read_len = num_values*sizeof(uint32); 905 ret_val = (REGFI_VALUE_LIST*)malloc(sizeof(REGFI_VALUE_LIST));894 ret_val = talloc(NULL, REGFI_VALUE_LIST); 906 895 if(ret_val == NULL) 907 896 return NULL; 908 897 909 ret_val->elements = (REGFI_VALUE_LIST_ELEM*) malloc(read_len);898 ret_val->elements = (REGFI_VALUE_LIST_ELEM*)talloc_size(ret_val, read_len); 910 899 if(ret_val->elements == NULL) 911 900 { 912 free(ret_val);901 talloc_free(ret_val); 913 902 return NULL; 914 903 } … … 921 910 regfi_add_message(file, REGFI_MSG_ERROR, "Failed to read value pointers" 922 911 " while parsing value list at offset 0x%.8X.", offset); 923 free(ret_val->elements); 924 free(ret_val); 912 talloc_free(ret_val); 925 913 return NULL; 926 914 } … … 942 930 " (0x%.8X) found while parsing value list at offset" 943 931 " 0x%.8X.", ret_val->elements[i], offset); 944 free(ret_val->elements); 945 free(ret_val); 932 talloc_free(ret_val); 946 933 return NULL; 947 934 } … … 956 943 /****************************************************************************** 957 944 ******************************************************************************/ 958 REGFI_VK_REC* regfi_load_value(REGFI_FILE* file, uint32 offset, 959 bool strict) 945 REGFI_VK_REC* regfi_load_value(REGFI_FILE* file, uint32 offset, bool strict) 960 946 { 961 947 REGFI_VK_REC* ret_val = NULL; … … 1009 995 ret_val->offset); 1010 996 } 997 else 998 talloc_steal(ret_val, ret_val->data); 1011 999 } 1012 1000 … … 1076 1064 if(strict) 1077 1065 { 1078 free(nk);1066 regfi_free_key(nk); 1079 1067 return NULL; 1080 1068 } … … 1095 1083 if(strict) 1096 1084 { 1097 free(nk);1085 regfi_free_key(nk); 1098 1086 return NULL; 1099 1087 } 1100 1088 } 1089 talloc_steal(nk, nk->values); 1101 1090 } 1102 1091 } … … 1109 1098 sub_hbin = regfi_lookup_hbin(file, nk->subkeys_off); 1110 1099 1111 if 1100 if(sub_hbin == NULL) 1112 1101 { 1113 1102 if(strict) 1114 1103 { 1115 regfi_ key_free(nk);1104 regfi_free_key(nk); 1116 1105 return NULL; 1117 1106 } … … 1132 1121 nk->num_subkeys = 0; 1133 1122 } 1123 talloc_steal(nk, nk->subkeys); 1134 1124 } 1135 1125 } … … 1214 1204 *root_offset = nk->offset; 1215 1205 } 1216 free(nk);1206 regfi_free_key(nk); 1217 1207 } 1218 1208 } … … 1267 1257 { 1268 1258 /* fprintf(stderr, "regfi_open: Failed to create HBIN list.\n"); */ 1269 range_list_free(rb->hbins);1270 1259 close(fd); 1271 free(rb); 1272 return NULL; 1273 } 1274 1260 talloc_free(rb); 1261 return NULL; 1262 } 1263 talloc_steal(rb, rb->hbins); 1264 1275 1265 rla = true; 1276 1266 hbin_off = REGFI_REGF_SIZE; … … 1292 1282 1293 1283 /* Cache an unlimited number of SK records. Typically there are very few. */ 1294 rb->sk_cache = lru_cache_create_ctx( NULL, 0, cache_secret, true);1284 rb->sk_cache = lru_cache_create_ctx(rb, 0, cache_secret, true); 1295 1285 1296 1286 /* Default message mask */ … … 1320 1310 lru_cache_destroy(file->sk_cache); 1321 1311 1322 free(file);1312 talloc_free(file); 1323 1313 return close(fd); 1324 1314 } … … 1361 1351 /****************************************************************************** 1362 1352 *****************************************************************************/ 1363 void regfi_key_free(REGFI_NK_REC* nk) 1364 { 1365 if((nk->values != NULL) && (nk->values_off!=REGFI_OFFSET_NONE)) 1366 { 1367 if(nk->values->elements != NULL) 1368 free(nk->values->elements); 1369 free(nk->values); 1370 } 1371 1353 void regfi_free_key(REGFI_NK_REC* nk) 1354 { 1372 1355 regfi_subkeylist_free(nk->subkeys); 1373 1374 if(nk->keyname != NULL) 1375 free(nk->keyname); 1376 if(nk->classname != NULL) 1377 free(nk->classname); 1378 1379 /* XXX: not freeing sec_desc because these are cached. This needs to be reviewed. */ 1380 free(nk); 1356 talloc_free(nk); 1357 } 1358 1359 1360 /****************************************************************************** 1361 *****************************************************************************/ 1362 void regfi_free_value(REGFI_VK_REC* vk) 1363 { 1364 talloc_free(vk); 1381 1365 } 1382 1366 … … 1388 1372 if(list != NULL) 1389 1373 { 1390 free(list->elements); 1391 free(list); 1374 talloc_free(list); 1392 1375 } 1393 1376 } … … 1399 1382 { 1400 1383 REGFI_NK_REC* root; 1401 REGFI_ITERATOR* ret_val = (REGFI_ITERATOR*)malloc(sizeof(REGFI_ITERATOR));1384 REGFI_ITERATOR* ret_val = talloc(NULL, REGFI_ITERATOR); 1402 1385 if(ret_val == NULL) 1403 1386 return NULL; … … 1406 1389 if(root == NULL) 1407 1390 { 1408 free(ret_val);1391 talloc_free(ret_val); 1409 1392 return NULL; 1410 1393 } … … 1413 1396 if(ret_val->key_positions == NULL) 1414 1397 { 1415 free(ret_val); 1416 return NULL; 1417 } 1398 talloc_free(ret_val); 1399 return NULL; 1400 } 1401 talloc_steal(ret_val, ret_val->key_positions); 1418 1402 1419 1403 ret_val->f = fh; … … 1430 1414 void regfi_iterator_free(REGFI_ITERATOR* i) 1431 1415 { 1432 REGFI_ITER_POSITION* cur; 1433 1434 if(i->cur_key != NULL) 1435 regfi_key_free(i->cur_key); 1436 1437 while((cur = (REGFI_ITER_POSITION*)void_stack_pop(i->key_positions)) != NULL) 1438 { 1439 regfi_key_free(cur->nk); 1440 free(cur); 1441 } 1442 1443 void_stack_free(i->key_positions); 1444 free(i); 1416 talloc_free(i); 1445 1417 } 1446 1418 … … 1455 1427 REGFI_ITER_POSITION* pos; 1456 1428 1457 pos = (REGFI_ITER_POSITION*)malloc(sizeof(REGFI_ITER_POSITION));1429 pos = talloc(i->key_positions, REGFI_ITER_POSITION); 1458 1430 if(pos == NULL) 1459 1431 return false; … … 1462 1434 if(subkey == NULL) 1463 1435 { 1464 free(pos);1436 talloc_free(pos); 1465 1437 return false; 1466 1438 } … … 1470 1442 if(!void_stack_push(i->key_positions, pos)) 1471 1443 { 1472 free(pos);1473 regfi_ key_free(subkey);1444 talloc_free(pos); 1445 regfi_free_key(subkey); 1474 1446 return false; 1475 1447 } 1448 talloc_steal(i, subkey); 1476 1449 1477 1450 i->cur_key = subkey; … … 1493 1466 return false; 1494 1467 1495 regfi_ key_free(i->cur_key);1468 regfi_free_key(i->cur_key); 1496 1469 i->cur_key = pos->nk; 1497 1470 i->cur_subkey = pos->cur_subkey; 1498 1471 i->cur_value = 0; 1499 free(pos);1472 talloc_free(pos); 1500 1473 1501 1474 return true; … … 1534 1507 else 1535 1508 { 1536 regfi_ key_free(subkey);1509 regfi_free_key(subkey); 1537 1510 subkey = (REGFI_NK_REC*)regfi_iterator_next_subkey(i); 1538 1511 } … … 1545 1518 } 1546 1519 1547 regfi_ key_free(subkey);1520 regfi_free_key(subkey); 1548 1521 return true; 1549 1522 } … … 1596 1569 /****************************************************************************** 1597 1570 *****************************************************************************/ 1598 constREGFI_NK_REC* regfi_iterator_first_subkey(REGFI_ITERATOR* i)1571 REGFI_NK_REC* regfi_iterator_first_subkey(REGFI_ITERATOR* i) 1599 1572 { 1600 1573 i->cur_subkey = 0; … … 1605 1578 /****************************************************************************** 1606 1579 *****************************************************************************/ 1607 constREGFI_NK_REC* regfi_iterator_cur_subkey(REGFI_ITERATOR* i)1580 REGFI_NK_REC* regfi_iterator_cur_subkey(REGFI_ITERATOR* i) 1608 1581 { 1609 1582 uint32 nk_offset; … … 1623 1596 *****************************************************************************/ 1624 1597 /* XXX: some way of indicating reason for failure should be added. */ 1625 constREGFI_NK_REC* regfi_iterator_next_subkey(REGFI_ITERATOR* i)1626 { 1627 constREGFI_NK_REC* subkey;1598 REGFI_NK_REC* regfi_iterator_next_subkey(REGFI_ITERATOR* i) 1599 { 1600 REGFI_NK_REC* subkey; 1628 1601 1629 1602 i->cur_subkey++; … … 1641 1614 bool regfi_iterator_find_value(REGFI_ITERATOR* i, const char* value_name) 1642 1615 { 1643 constREGFI_VK_REC* cur;1616 REGFI_VK_REC* cur; 1644 1617 bool found = false; 1645 1618 … … 1657 1630 found = true; 1658 1631 else 1632 { 1633 regfi_free_value(cur); 1659 1634 cur = regfi_iterator_next_value(i); 1635 } 1660 1636 } 1661 1637 … … 1666 1642 /****************************************************************************** 1667 1643 *****************************************************************************/ 1668 constREGFI_VK_REC* regfi_iterator_first_value(REGFI_ITERATOR* i)1644 REGFI_VK_REC* regfi_iterator_first_value(REGFI_ITERATOR* i) 1669 1645 { 1670 1646 i->cur_value = 0; … … 1675 1651 /****************************************************************************** 1676 1652 *****************************************************************************/ 1677 constREGFI_VK_REC* regfi_iterator_cur_value(REGFI_ITERATOR* i)1678 { 1679 constREGFI_VK_REC* ret_val = NULL;1653 REGFI_VK_REC* regfi_iterator_cur_value(REGFI_ITERATOR* i) 1654 { 1655 REGFI_VK_REC* ret_val = NULL; 1680 1656 uint32 voffset; 1681 1657 … … 1695 1671 /****************************************************************************** 1696 1672 *****************************************************************************/ 1697 constREGFI_VK_REC* regfi_iterator_next_value(REGFI_ITERATOR* i)1698 { 1699 constREGFI_VK_REC* ret_val;1673 REGFI_VK_REC* regfi_iterator_next_value(REGFI_ITERATOR* i) 1674 { 1675 REGFI_VK_REC* ret_val; 1700 1676 1701 1677 i->cur_value++; … … 1739 1715 REGFI_FILE* ret_val; 1740 1716 1741 ret_val = (REGFI_FILE*)zalloc(sizeof(REGFI_FILE));1717 ret_val = talloc(NULL, REGFI_FILE); 1742 1718 if(ret_val == NULL) 1743 1719 return NULL; 1744 1720 1745 1721 ret_val->fd = fd; 1746 1722 ret_val->sk_cache = NULL; 1723 ret_val->last_message = NULL; 1724 ret_val->hbins = NULL; 1725 1747 1726 length = REGFI_REGF_SIZE; 1748 if((regfi_read(fd, file_header, &length)) != 0 1749 || length != REGFI_REGF_SIZE) 1750 { 1751 free(ret_val); 1752 return NULL; 1753 } 1754 1727 if((regfi_read(fd, file_header, &length)) != 0 || length != REGFI_REGF_SIZE) 1728 goto fail; 1729 1755 1730 ret_val->checksum = IVAL(file_header, 0x1FC); 1756 1731 ret_val->computed_checksum = regfi_compute_header_checksum(file_header); 1757 1732 if (strict && (ret_val->checksum != ret_val->computed_checksum)) 1758 { 1759 free(ret_val); 1760 return NULL; 1761 } 1733 goto fail; 1762 1734 1763 1735 memcpy(ret_val->magic, file_header, REGFI_REGF_MAGIC_SIZE); 1764 if(strict && (memcmp(ret_val->magic, "regf", REGFI_REGF_MAGIC_SIZE) != 0)) 1765 { 1766 free(ret_val); 1767 return NULL; 1736 if(memcmp(ret_val->magic, "regf", REGFI_REGF_MAGIC_SIZE) != 0) 1737 { 1738 if(strict) 1739 goto fail; 1740 regfi_add_message(ret_val, REGFI_MSG_WARN, "Magic number mismatch " 1741 "(%.2X %.2X %.2X %.2X) while parsing hive header", 1742 ret_val->magic[0],ret_val->magic[1], 1743 ret_val->magic[2], ret_val->magic[3]); 1768 1744 } 1769 1745 … … 1785 1761 1786 1762 return ret_val; 1763 1764 fail: 1765 talloc_free(ret_val); 1766 return NULL; 1787 1767 } 1788 1768 … … 1891 1871 } 1892 1872 1893 ret_val = (REGFI_NK_REC*)zalloc(sizeof(REGFI_NK_REC));1873 ret_val = talloc(NULL, REGFI_NK_REC); 1894 1874 if(ret_val == NULL) 1895 1875 { … … 1899 1879 } 1900 1880 1881 ret_val->values = NULL; 1882 ret_val->subkeys = NULL; 1901 1883 ret_val->offset = offset; 1902 1884 ret_val->cell_size = cell_length; … … 1909 1891 regfi_add_message(file, REGFI_MSG_WARN, "A length check failed while" 1910 1892 " parsing NK record at offset 0x%.8X.", offset); 1911 free(ret_val);1893 talloc_free(ret_val); 1912 1894 return NULL; 1913 1895 } … … 1969 1951 regfi_add_message(file, REGFI_MSG_ERROR, "Contents too large for cell" 1970 1952 " while parsing NK record at offset 0x%.8X.", offset); 1971 free(ret_val);1953 talloc_free(ret_val); 1972 1954 return NULL; 1973 1955 } … … 1987 1969 } 1988 1970 1989 ret_val->keyname = (char*)zalloc(sizeof(char)*(ret_val->name_length+1));1971 ret_val->keyname = talloc_array(ret_val, char, ret_val->name_length+1); 1990 1972 if(ret_val->keyname == NULL) 1991 1973 { 1992 free(ret_val);1974 talloc_free(ret_val); 1993 1975 return NULL; 1994 1976 } … … 2001 1983 regfi_add_message(file, REGFI_MSG_ERROR, "Failed to read key name" 2002 1984 " while parsing NK record at offset 0x%.8X.", offset); 2003 free(ret_val->keyname); 2004 free(ret_val); 1985 talloc_free(ret_val); 2005 1986 return NULL; 2006 1987 } 2007 1988 ret_val->keyname[ret_val->name_length] = '\0'; 2008 1989 1990 /* XXX: This linking should be moved up to regfi_load_key */ 2009 1991 if(ret_val->classname_off != REGFI_OFFSET_NONE) 2010 1992 { … … 2031 2013 " name while parsing NK record at offset 0x%.8X.", 2032 2014 offset); 2033 return NULL; 2034 } 2015 } 2016 else 2017 talloc_steal(ret_val, ret_val->classname); 2035 2018 } 2036 2019 … … 2084 2067 } 2085 2068 2086 ret_val = (char*)zalloc(*name_length);2069 ret_val = talloc_array(NULL, char, *name_length); 2087 2070 if(ret_val != NULL) 2088 2071 { … … 2093 2076 regfi_add_message(file, REGFI_MSG_ERROR, "Could not read class name" 2094 2077 " while parsing class name at offset 0x%.8X.", offset); 2095 free(ret_val);2078 talloc_free(ret_val); 2096 2079 return NULL; 2097 2080 } … … 2121 2104 } 2122 2105 2123 ret_val = (REGFI_VK_REC*)zalloc(sizeof(REGFI_VK_REC));2106 ret_val = talloc(NULL, REGFI_VK_REC); 2124 2107 if(ret_val == NULL) 2125 2108 return NULL; … … 2127 2110 ret_val->offset = offset; 2128 2111 ret_val->cell_size = cell_length; 2129 2112 ret_val->data = NULL; 2113 ret_val->valuename = NULL; 2114 2130 2115 if(ret_val->cell_size > max_size) 2131 2116 ret_val->cell_size = max_size & 0xFFFFFFF8; … … 2135 2120 regfi_add_message(file, REGFI_MSG_WARN, "Invalid cell size encountered" 2136 2121 " while parsing VK record at offset 0x%.8X.", offset); 2137 free(ret_val);2122 talloc_free(ret_val); 2138 2123 return NULL; 2139 2124 } … … 2149 2134 regfi_add_message(file, REGFI_MSG_WARN, "Magic number mismatch" 2150 2135 " while parsing VK record at offset 0x%.8X.", offset); 2151 free(ret_val);2136 talloc_free(ret_val); 2152 2137 return NULL; 2153 2138 } … … 2171 2156 if(strict) 2172 2157 { 2173 free(ret_val);2158 talloc_free(ret_val); 2174 2159 return NULL; 2175 2160 } … … 2183 2168 cell_length+=8; 2184 2169 2185 ret_val->valuename = (char*)zalloc(sizeof(char)*(ret_val->name_length+1));2170 ret_val->valuename = talloc_array(ret_val, char, ret_val->name_length+1); 2186 2171 if(ret_val->valuename == NULL) 2187 2172 { 2188 free(ret_val);2173 talloc_free(ret_val); 2189 2174 return NULL; 2190 2175 } … … 2196 2181 regfi_add_message(file, REGFI_MSG_ERROR, "Could not read value name" 2197 2182 " while parsing VK record at offset 0x%.8X.", offset); 2198 free(ret_val->valuename); 2199 free(ret_val); 2183 talloc_free(ret_val); 2200 2184 return NULL; 2201 2185 } … … 2238 2222 } 2239 2223 2240 if((ret_val = (uint8*)zalloc(sizeof(uint8)*length)) == NULL)2224 if((ret_val = talloc_array(NULL, uint8_t, length)) == NULL) 2241 2225 return NULL; 2242 2226 … … 2289 2273 } 2290 2274 2291 if((ret_val = (uint8*)zalloc(sizeof(uint8)*length)) == NULL)2275 if((ret_val = talloc_array(NULL, uint8_t, length)) == NULL) 2292 2276 return NULL; 2293 2277 … … 2298 2282 regfi_add_message(file, REGFI_MSG_ERROR, "Could not read data block while" 2299 2283 " parsing data record at offset 0x%.8X.", offset); 2300 free(ret_val);2284 talloc_free(ret_val); 2301 2285 return NULL; 2302 2286 } -
trunk/lib/void_stack.c
r147 r150 4 4 * leaks. 5 5 * 6 * Copyright (C) 2005,2007 Timothy D. Morgan6 * Copyright (C) 2005,2007,2009 Timothy D. Morgan 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify … … 26 26 void_stack* void_stack_new(unsigned short max_size) 27 27 { 28 void_stack* ret_val = (void_stack*)malloc(sizeof(void_stack));28 void_stack* ret_val = talloc(NULL, void_stack); 29 29 30 30 if (ret_val != NULL) 31 31 { 32 32 memset(ret_val, 0, sizeof(*ret_val)); 33 ret_val->elements = (void**)malloc(max_size*sizeof(void*));33 ret_val->elements = talloc_array(ret_val, void*, max_size); 34 34 if (ret_val->elements == NULL) 35 35 { 36 free(ret_val);36 talloc_free(ret_val); 37 37 ret_val = NULL; 38 38 } … … 90 90 void void_stack_free(void_stack* stack) 91 91 { 92 free(stack->elements); 93 free(stack); 92 talloc_free(stack); 94 93 } 95 94 … … 100 99 for(i=0; i < stack->top; i++) 101 100 free(stack->elements[i]); 102 free(stack->elements); 103 free(stack); 101 talloc_free(stack); 104 102 } 105 103 … … 154 152 if(stack != NULL) 155 153 { 156 ret_val = (void_stack_iterator*)malloc(sizeof(void_stack_iterator));154 ret_val = talloc(stack, void_stack_iterator); 157 155 if (ret_val != NULL) 158 156 { … … 168 166 void void_stack_iterator_free(void_stack_iterator* iter) 169 167 { 170 free(iter);168 talloc_free(iter); 171 169 } 172 170
Note: See TracChangeset
for help on using the changeset viewer.