diff mbox series

if-to-switch: fix a memory leak

Message ID e827242f-4e90-7379-50a7-103f338cc919@suse.cz
State New
Headers show
Series if-to-switch: fix a memory leak | expand

Commit Message

Martin Liška Feb. 9, 2021, 4:24 p.m. UTC
The following fixes a memory leak.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

gcc/ChangeLog:

	PR tree-optimization/99002
	* gimple-if-to-switch.cc (find_conditions): Fix memory leak
	in the function.
---
  gcc/gimple-if-to-switch.cc | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Richard Biener Feb. 9, 2021, 5:37 p.m. UTC | #1
On Tue, Feb 9, 2021 at 6:16 PM Martin Liška <mliska@suse.cz> wrote:
>
> The following fixes a memory leak.
>
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>
> Ready to be installed?

OK.

Richard.

> Thanks,
> Martin
>
> gcc/ChangeLog:
>
>         PR tree-optimization/99002
>         * gimple-if-to-switch.cc (find_conditions): Fix memory leak
>         in the function.
> ---
>   gcc/gimple-if-to-switch.cc | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/gcc/gimple-if-to-switch.cc b/gcc/gimple-if-to-switch.cc
> index 1712fc4c8b3..f39662be3e6 100644
> --- a/gcc/gimple-if-to-switch.cc
> +++ b/gcc/gimple-if-to-switch.cc
> @@ -447,10 +447,9 @@ find_conditions (basic_block bb,
>         info->record_phi_mapping (info->m_false_edge,
>                                 &info->m_false_edge_phi_mapping);
>         conditions_in_bbs->put (bb, info);
> +      return;
>       }
>
> -  return;
> -
>   exit:
>     delete info;
>   }
> --
> 2.30.0
>
diff mbox series

Patch

diff --git a/gcc/gimple-if-to-switch.cc b/gcc/gimple-if-to-switch.cc
index 1712fc4c8b3..f39662be3e6 100644
--- a/gcc/gimple-if-to-switch.cc
+++ b/gcc/gimple-if-to-switch.cc
@@ -447,10 +447,9 @@  find_conditions (basic_block bb,
        info->record_phi_mapping (info->m_false_edge,
  				&info->m_false_edge_phi_mapping);
        conditions_in_bbs->put (bb, info);
+      return;
      }
  
-  return;
-
  exit:
    delete info;
  }