Changeset 228 for trunk/lib/regfi.c
- Timestamp:
- 04/18/11 16:25:46 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/regfi.c
r226 r228 1617 1617 } 1618 1618 1619 if(pthread_mutex_init(&rb->mem_lock, NULL) != 0) 1620 { 1621 regfi_log_add(REGFI_LOG_ERROR, "Failed to create mem_lock mutex."); 1622 goto fail; 1623 } 1624 1619 1625 rb->hbins = range_list_new(); 1620 1626 if(rb->hbins == NULL) … … 1657 1663 pthread_rwlock_destroy(&rb->hbins_lock); 1658 1664 pthread_mutex_destroy(&rb->sk_lock); 1665 pthread_mutex_destroy(&rb->mem_lock); 1659 1666 1660 1667 range_list_free(rb->hbins); … … 1721 1728 /****************************************************************************** 1722 1729 *****************************************************************************/ 1723 void regfi_free_record(const void* record) 1724 { 1730 void regfi_free_record(REGFI_FILE* file, const void* record) 1731 { 1732 if(!regfi_lock(file, &file->mem_lock, "regfi_free_record")) 1733 return; 1734 1725 1735 talloc_unlink(NULL, (void*)record); 1736 1737 regfi_unlock(file, &file->mem_lock, "regfi_free_record"); 1726 1738 } 1727 1739 … … 1729 1741 /****************************************************************************** 1730 1742 *****************************************************************************/ 1731 bool regfi_reference_record(const void* record) 1732 { 1743 bool regfi_reference_record(REGFI_FILE* file, const void* record) 1744 { 1745 bool ret_val = false; 1746 if(!regfi_lock(file, &file->mem_lock, "regfi_reference_record")) 1747 return ret_val; 1748 1733 1749 if(talloc_reference(NULL, record) != NULL) 1734 return true; 1735 return false; 1750 ret_val = true; 1751 1752 regfi_unlock(file, &file->mem_lock, "regfi_reference_record"); 1753 return ret_val; 1736 1754 } 1737 1755 … … 1823 1841 void regfi_iterator_free(REGFI_ITERATOR* i) 1824 1842 { 1825 talloc_ free(i);1843 talloc_unlink(NULL, i); 1826 1844 } 1827 1845 … … 1854 1872 talloc_unlink(NULL, subkey); 1855 1873 return false; 1856 } 1874 } 1857 1875 talloc_reparent(NULL, i, subkey); 1858 1876 … … 1875 1893 return false; 1876 1894 1895 if(!regfi_lock(i->f, &i->f->mem_lock, "regfi_iterator_up")) 1896 return false; 1897 1877 1898 talloc_unlink(i, i->cur_key); 1899 regfi_unlock(i->f, &i->f->mem_lock, "regfi_iterator_up"); 1900 1878 1901 i->cur_key = pos->nk; 1879 1902 i->cur_subkey = pos->cur_subkey; … … 1943 1966 const REGFI_NK* regfi_iterator_cur_key(REGFI_ITERATOR* i) 1944 1967 { 1945 return talloc_reference(NULL, i->cur_key); 1968 const REGFI_NK* ret_val = NULL; 1969 if(!regfi_lock(i->f, &i->f->mem_lock, "regfi_iterator_cur_key")) 1970 return ret_val; 1971 1972 ret_val = talloc_reference(NULL, i->cur_key); 1973 1974 regfi_unlock(i->f, &i->f->mem_lock, "regfi_iterator_cur_key"); 1975 return ret_val; 1946 1976 } 1947 1977 … … 2174 2204 } 2175 2205 2176 regfi_free_record( cur);2206 regfi_free_record(file, cur); 2177 2207 } 2178 2208 … … 2211 2241 } 2212 2242 2213 regfi_free_record( cur);2243 regfi_free_record(file, cur); 2214 2244 } 2215 2245 … … 2257 2287 { 2258 2288 if(key != NULL && key->parent_off != REGFI_OFFSET_NONE) 2259 {2260 /* fprintf(stderr, "key->parent_off=%.8X\n", key->parent_off);*/2261 2289 return regfi_load_key(file, 2262 2290 key->parent_off+REGFI_REGF_SIZE, 2263 2291 file->string_encoding, true); 2264 } 2265 2292 2266 2293 return NULL; 2267 2294 }
Note: See TracChangeset
for help on using the changeset viewer.