Replace "if (x) free (x)" with "free (x)", gprof

Message ID 20200521012318.GF16548@bubble.grove.modra.org
State New
Headers show
Series
  • Replace "if (x) free (x)" with "free (x)", gprof
Related show

Commit Message

* utils.c (print_name_only): Free demangled without checking
	first for non-NULL.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/gprof/utils.c b/gprof/utils.c
index 4fc2db6038..76bc57d318 100644
--- a/gprof/utils.c
+++ b/gprof/utils.c
@@ -85,10 +85,7 @@  print_name_only (Sym *self)
 	  printf ("%s", buf);
 	  size += strlen (buf);
 	}
-      if (demangled)
-	{
-	  free (demangled);
-	}
+      free (demangled);
       DBG (DFNDEBUG, printf ("{%d} ", self->cg.top_order));
       DBG (PROPDEBUG, printf ("%4.0f%% ", 100.0 * self->cg.prop.fract));
     }