From: Richard Biener Date: Thu, 18 Jan 2024 12:04:17 +0000 (+0100) Subject: Fix memory leak in vectorizable_store X-Git-Tag: basepoints/gcc-15~1911 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5b421c2a5b429fcebd7ee6444a5677633df0f28a;p=thirdparty%2Fgcc.git Fix memory leak in vectorizable_store The following fixes a memory leak in vectorizable_store which happens because the functions populating gvec_oprnds[i] will call .create () on the incoming vector, leaking what we've previously allocated. * tree-vect-stmts.cc (vectorizable_store): Do not allocate storage for gvec_oprnds elements. --- diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index cabd4e3ae864..69d76c3b350f 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -8772,7 +8772,7 @@ vectorizable_store (vec_info *vinfo, tree vec_mask = NULL; auto_delete_vec> gvec_oprnds (group_size); for (i = 0; i < group_size; i++) - gvec_oprnds.quick_push (new auto_vec (ncopies)); + gvec_oprnds.quick_push (new auto_vec ()); if (memory_access_type == VMAT_LOAD_STORE_LANES) {