Patchwork [SMS] Free sccs field

login
register
mail settings
Submitter Revital Eres
Date April 15, 2011, 3:27 p.m.
Message ID <BANLkTi=-wO8eudyeWeGaZ320=zgnTSfLzw@mail.gmail.com>
Download mbox | patch
Permalink /patch/91392/
State New
Headers show

Comments

Revital Eres - April 15, 2011, 3:27 p.m.
Hello,

The attached patch adds missing free operation for storage
allocated while calculating SCCs.

Bootstrap and regtested on ppc64-redhat-linux.

OK for mainline?

Thanks,
Revital

Changelog:

        * ddg.c (free_ddg_all_sccs): Free sccs field in struct ddg_all_sccs.
Richard Guenther - April 15, 2011, 3:40 p.m.
On Fri, Apr 15, 2011 at 5:27 PM, Revital Eres <revital.eres@linaro.org> wrote:
> Hello,
>
> The attached patch adds missing free operation for storage
> allocated while calculating SCCs.
>
> Bootstrap and regtested on ppc64-redhat-linux.
>
> OK for mainline?

Ok.

Thanks,
Richard.

> Thanks,
> Revital
>
> Changelog:
>
>        * ddg.c (free_ddg_all_sccs): Free sccs field in struct ddg_all_sccs.
>
> Index: ddg.c
> ===================================================================
> --- ddg.c       (revision 171573)
> +++ ddg.c       (working copy)
> @@ -1011,6 +1082,8 @@ free_ddg_all_sccs (ddg_all_sccs_ptr all_
>   for (i = 0; i < all_sccs->num_sccs; i++)
>     free_scc (all_sccs->sccs[i]);
>
> +  if (all_sccs->sccs)
> +    free (all_sccs->sccs);
>   free (all_sccs);
>  }
>
Nathan Froyd - April 15, 2011, 3:53 p.m.
On Fri, Apr 15, 2011 at 06:27:05PM +0300, Revital Eres wrote:
> +  if (all_sccs->sccs)
> +    free (all_sccs->sccs);

No need to check for non-NULL prior to free'ing.

-Nathan
Revital Eres - April 15, 2011, 4:54 p.m.
Hello,

On 15 April 2011 18:53, Nathan Froyd <froydnj@codesourcery.com> wrote:
> On Fri, Apr 15, 2011 at 06:27:05PM +0300, Revital Eres wrote:
>> +  if (all_sccs->sccs)
>> +    free (all_sccs->sccs);
>
> No need to check for non-NULL prior to free'ing.

OK, I'll commit the patch without the check then.
(after re-testing)

Thanks,
Revital


>
> -Nathan
>
>

Patch

Index: ddg.c
===================================================================
--- ddg.c       (revision 171573)
+++ ddg.c       (working copy)
@@ -1011,6 +1082,8 @@  free_ddg_all_sccs (ddg_all_sccs_ptr all_
   for (i = 0; i < all_sccs->num_sccs; i++)
     free_scc (all_sccs->sccs[i]);

+  if (all_sccs->sccs)
+    free (all_sccs->sccs);
   free (all_sccs);
 }