|
From: | Vladimir 'phcoder' Serbinenko |
Subject: | Re: Re: [PATCH 1/1] grub-menulst2cfg.c |
Date: | Sat, 11 Jul 2020 13:07:06 +0200 |
On Fri, Jul 10, 2020, 11:19 朱光宏 <zhuguanghong@uniontech.com> 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 codefree already checks for nullness of its argument. Any reason for this patch?
On Thu, Jul 9, 2020, 15:11 GuangHong Zhu <zhuguanghong@uniontech.com> 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);
--
2.20.1
[Prev in Thread] | Current Thread | [Next in Thread] |