[subset] fix memory leaks found in https://oss-fuzz.com/testcase-detail/5179935334465536
This commit is contained in:
parent
bd2950b393
commit
c5c13006a1
|
@ -147,6 +147,7 @@ struct graph_t
|
||||||
}
|
}
|
||||||
|
|
||||||
vertex_t* v = vertices_.push ();
|
vertex_t* v = vertices_.push ();
|
||||||
|
if (check_success (!vertices_.in_error ()))
|
||||||
v->obj = *objects[i];
|
v->obj = *objects[i];
|
||||||
if (!removed_nil) continue;
|
if (!removed_nil) continue;
|
||||||
for (unsigned i = 0; i < v->obj.links.length; i++)
|
for (unsigned i = 0; i < v->obj.links.length; i++)
|
||||||
|
|
|
@ -177,6 +177,11 @@ struct hb_vector_t
|
||||||
Type *push (T&& v)
|
Type *push (T&& v)
|
||||||
{
|
{
|
||||||
Type *p = push ();
|
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);
|
*p = hb_forward<T> (v);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue