diff mbox

Fix memory leak in tree-ssa-reassoc.c

Message ID d746bb97-cf6b-8aa9-eeb4-d48f3c5aedc3@suse.cz
State New
Headers show

Commit Message

Martin Liška June 17, 2016, 1:14 p.m. UTC
Hi.

Following simple patch fixes a newly introduced memory leak.

Patch survives regression tests and bootstraps on x86_64-linux.

Ready from trunk?
Thanks,
Martin

Comments

Jeff Law June 17, 2016, 4:48 p.m. UTC | #1
On 06/17/2016 07:14 AM, Martin Liška wrote:
> Hi.
>
> Following simple patch fixes a newly introduced memory leak.
>
> Patch survives regression tests and bootstraps on x86_64-linux.
>
> Ready from trunk?
> Thanks,
> Martin
>
>
> 0001-Fix-memory-leak-in-tree-ssa-reassoc.c.patch
>
>
> From a2e6be16d7079b744db4d383b8317226ab53ff58 Mon Sep 17 00:00:00 2001
> From: marxin <mliska@suse.cz>
> Date: Fri, 17 Jun 2016 12:26:58 +0200
> Subject: [PATCH] Fix memory leak in tree-ssa-reassoc.c
>
> gcc/ChangeLog:
>
> 2016-06-17  Martin Liska  <mliska@suse.cz>
>
> 	* tree-ssa-reassoc.c (transform_add_to_multiply): Use auto_vec.
OK.

And more generally, conversion from vec to auto_vec to fix memory leaks 
or eliminate explicit memory management is pre-approved.

Jeff
diff mbox

Patch

From a2e6be16d7079b744db4d383b8317226ab53ff58 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Fri, 17 Jun 2016 12:26:58 +0200
Subject: [PATCH] Fix memory leak in tree-ssa-reassoc.c

gcc/ChangeLog:

2016-06-17  Martin Liska  <mliska@suse.cz>

	* tree-ssa-reassoc.c (transform_add_to_multiply): Use auto_vec.
---
 gcc/tree-ssa-reassoc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index e32d503..cdfe06f 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -1807,7 +1807,7 @@  transform_add_to_multiply (vec<operand_entry *> *ops)
   tree op = NULL_TREE;
   int j;
   int i, start = -1, end = 0, count = 0;
-  vec<std::pair <int, int> > indxs = vNULL;
+  auto_vec<std::pair <int, int> > indxs;
   bool changed = false;
 
   if (!INTEGRAL_TYPE_P (TREE_TYPE ((*ops)[0]->op))
-- 
2.8.3