[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: [PATCH 1/1] grub-menulst2cfg.c

From: Vladimir 'phcoder' Serbinenko
Subject: Re: Re: [PATCH 1/1] grub-menulst2cfg.c
Date: Sat, 11 Jul 2020 13:07:06 +0200

On Sat, Jul 11, 2020, 13:01 Vladimir 'phcoder' Serbinenko <> wrote:

On Fri, Jul 10, 2020, 11:19 朱光宏 <> wrote:

In many cases, entryname is null, so there is no need to call this function often, it is faster to do this, what do you think?

Is it a tight loop where such an optimisation matters? Did you measure performance gain? If not, it's better to go for existing code conventions and readadble code

free already checks for nullness of its argument. Any reason for this patch?

On Thu, Jul 9, 2020, 15:11 GuangHong Zhu <> wrote:
 util/grub-menulst2cfg.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/util/grub-menulst2cfg.c b/util/grub-menulst2cfg.c
index a39f86939..6f7587347 100644
--- a/util/grub-menulst2cfg.c
+++ b/util/grub-menulst2cfg.c
@@ -124,7 +124,9 @@ main (int argc, char **argv)

   free (buf);
   free (suffix);
-  free (entryname);

+  if(entryname)
+    free (entryname);

   if (in != stdin)
     fclose (in);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]