Replace "if (x) free (x)" with "free (x)", gprof
authorAlan Modra <amodra@gmail.com>
Wed, 20 May 2020 13:19:51 +0000 (22:49 +0930)
committerAlan Modra <amodra@gmail.com>
Thu, 21 May 2020 01:15:33 +0000 (10:45 +0930)
* utils.c (print_name_only): Free demangled without checking
first for non-NULL.

gprof/ChangeLog
gprof/utils.c

index 29043ac471e1217c6e8b3541d46386a22dfaea80..59fba06e78764d7c62ea07b19440f497bf701374 100644 (file)
@@ -1,3 +1,8 @@
+2020-05-21  Alan Modra  <amodra@gmail.com>
+
+       * utils.c (print_name_only): Free demangled without checking
+       first for non-NULL.
+
 2020-05-18  Nick Clifton  <nickc@redhat.com>
 
        * po/es.po: Update Spanish translation.
index 4fc2db6038e94c91965a0120c37dbd5190503489..76bc57d31831994d696795b58cf5fb8e1cce51b3 100644 (file)
@@ -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));
     }