[subset] fix memory leak in repacker caused by failed alloc.

Fixes: https://oss-fuzz.com/testcase-detail/5616763250278400.
This commit is contained in:
Garret Rieger 2021-04-19 16:09:37 -07:00 committed by Behdad Esfahbod
parent 3fb62cdc14
commit 0e845d973e
2 changed files with 3 additions and 1 deletions

View File

@ -343,7 +343,9 @@ struct graph_t
auto* clone = vertices_.push ();
auto& child = vertices_[child_idx];
clone_buffer_t* buffer = clone_buffers_.push ();
if (!check_success (buffer->copy (child.obj))) {
if (vertices_.in_error ()
|| clone_buffers_.in_error ()
|| !check_success (buffer->copy (child.obj))) {
return;
}