提交 b1862743 编写于 作者: B Behdad Esfahbod

[set/map] Fix uninitialized memory

I keep forgetting that primitive types are NOT initialized during construction. :|
上级 ad3ceded
......@@ -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
{
......
......@@ -272,6 +272,7 @@ static inline void hb_object_fini (Type *obj)
{
user_data->fini ();
free (user_data);
user_data = nullptr;
}
}
template <typename Type>
......
......@@ -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
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册