diff mbox

trial fix to null pointer free

Message ID BANLkTi=J+oP-dHXgP5Kvna6W3pMwH4Fnrg@mail.gmail.com
State New
Headers show

Commit Message

Diego Novillo April 28, 2011, 12:33 a.m. UTC
On Wed, Apr 27, 2011 at 19:23, Xinliang David Li <davidxl@google.com> wrote:
> This can happen when the module does not have function bodies.
>
>
> Ok after testing?
>
> Thanks,
>
> David
>
>
> 2011-04-27  Xinliang David Li  <davidxl@google.com>
>
>        * value-prof.c (del_node_map): Do not free
>        null pointer.
>

remove the assignment 'cgraph_node_map = NULL' since VEC_free already
clears it.


Diego.
diff mbox

Patch

Index: value-prof.c
===================================================================
--- value-prof.c	(revision 172977)
+++ value-prof.c	(working copy)
@@ -1086,8 +1086,9 @@  init_node_map (void)
 void
 del_node_map (void)
 {
-   VEC_free (cgraph_node_ptr, heap, cgraph_node_map);
-   cgraph_node_map = NULL;
+  if (cgraph_node_map)
+    VEC_free (cgraph_node_ptr, heap, cgraph_node_map);
+  cgraph_node_map = NULL;
 }

This is not necessary.  Freeing a NULL VEC has no effect.  You could