[subset] fix memory leaks found in https://oss-fuzz.com/testcase-detail/5179935334465536
This commit is contained in:
parent
bd2950b393
commit
c5c13006a1
|
@ -147,7 +147,8 @@ struct graph_t
|
|||
}
|
||||
|
||||
vertex_t* v = vertices_.push ();
|
||||
v->obj = *objects[i];
|
||||
if (check_success (!vertices_.in_error ()))
|
||||
v->obj = *objects[i];
|
||||
if (!removed_nil) continue;
|
||||
for (unsigned i = 0; i < v->obj.links.length; i++)
|
||||
// Fix indices to account for removed nil object.
|
||||
|
|
|
@ -177,6 +177,11 @@ struct hb_vector_t
|
|||
Type *push (T&& v)
|
||||
{
|
||||
Type *p = push ();
|
||||
if (p == &Crap (Type))
|
||||
// If push failed to allocate then don't copy v, since this may cause
|
||||
// the created copy to leak memory since we won't have stored a
|
||||
// reference to it.
|
||||
return p;
|
||||
*p = hb_forward<T> (v);
|
||||
return p;
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue