Skip to content

Add a few missing delete to allocated temporaries #4020

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions gcc/rust/rust-gcc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1433,6 +1433,7 @@ array_initializer (tree fndecl, tree block, tree array_type, tree length,
length, true, locus, &t);
tree len = tmp_len->get_tree (locus);
stmts.push_back (t);
delete tmp_len;

// Temporary variable for pointer used to initialize elements.
tree ptr_type = pointer_type (TREE_TYPE (array_type));
Expand All @@ -1443,6 +1444,7 @@ array_initializer (tree fndecl, tree block, tree array_type, tree length,
= temporary_variable (fndecl, block, ptr_type, ptr_init, false, locus, &t);
tree ptr = tmp_ptr->get_tree (locus);
stmts.push_back (t);
delete tmp_ptr;

// push statement list for the loop
std::vector<tree> loop_stmts;
Expand Down Expand Up @@ -1479,6 +1481,7 @@ array_initializer (tree fndecl, tree block, tree array_type, tree length,
// Return the temporary in the provided pointer and the statement list which
// initializes it.
*tmp = tmp_array->get_tree (locus);
delete tmp_array;
return statement_list (stmts);
}

Expand Down
Loading