[set/map] Fix uninitialized memory

I keep forgetting that primitive types are NOT initialized during construction. :|
This commit is contained in:
Behdad Esfahbod 2018-10-29 23:21:14 -07:00
parent ad3cededdd
commit b186274362
3 changed files with 5 additions and 4 deletions

View File

@ -45,8 +45,8 @@ inline uint32_t Hash (const T &v)
struct hb_map_t
{
HB_NO_COPY_ASSIGN (hb_map_t);
inline hb_map_t (void) { init_shallow (); }
inline ~hb_map_t (void) { fini_shallow (); }
inline hb_map_t (void) { init (); }
inline ~hb_map_t (void) { fini (); }
struct item_t
{

View File

@ -272,6 +272,7 @@ static inline void hb_object_fini (Type *obj)
{
user_data->fini ();
free (user_data);
user_data = nullptr;
}
}
template <typename Type>

View File

@ -40,8 +40,8 @@
struct hb_set_t
{
HB_NO_COPY_ASSIGN (hb_set_t);
inline hb_set_t (void) { init_shallow (); }
inline ~hb_set_t (void) { fini_shallow (); }
inline hb_set_t (void) { init (); }
inline ~hb_set_t (void) { fini (); }
struct page_map_t
{