public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-8228] Fix memory leak in vectorizable_store
Date: Thu, 18 Jan 2024 13:14:20 +0000 (GMT)	[thread overview]
Message-ID: <20240118131420.DA9A0386D625@sourceware.org> (raw)

https://gcc.gnu.org/g:5b421c2a5b429fcebd7ee6444a5677633df0f28a

commit r14-8228-g5b421c2a5b429fcebd7ee6444a5677633df0f28a
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jan 18 13:04:17 2024 +0100

    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:
---
 gcc/tree-vect-stmts.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index cabd4e3ae86..69d76c3b350 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<auto_vec<tree>> gvec_oprnds (group_size);
   for (i = 0; i < group_size; i++)
-    gvec_oprnds.quick_push (new auto_vec<tree> (ncopies));
+    gvec_oprnds.quick_push (new auto_vec<tree> ());
 
   if (memory_access_type == VMAT_LOAD_STORE_LANES)
     {

                 reply	other threads:[~2024-01-18 13:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240118131420.DA9A0386D625@sourceware.org \
    --to=rguenth@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).