make sure all nodes are correctly freed in create_property_node()

We make sure that the newly created tree and all remaining nodes passed in
in the node_array are freed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
duerst 2018-11-27 21:00:06 +00:00
Родитель 50441014ff
Коммит 7086aae378
1 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -5770,6 +5770,10 @@ create_sequence_node(Node **np, Node **node_array)
while (--i >= 0) { while (--i >= 0) {
*np = node_new_list(node_array[i], tmp); *np = node_new_list(node_array[i], tmp);
if (IS_NULL(*np)) { if (IS_NULL(*np)) {
while (i >= 0) {
onig_node_free(node_array[i]);
node_array[i--] = NULL_NODE;
}
onig_node_free(tmp); onig_node_free(tmp);
return ONIGERR_MEMORY; return ONIGERR_MEMORY;
} }