Skip to contentSkip to conversation

grub-menulst2cfg.c

PATCH Vladimir 'phcoder' Serbinenko 1 participant 1 message Jul 11, 2020 4 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): CAEaD8JMF31_JAh6YO10HRuWewO5Wbd6aW7EJV7qwLxhW5Ksdmg@mail.gmail.com

A message that is not in the archive (sent off-list or not yet received): 173722886.2286858.1594372744187.JavaMail.xmail@bj-wm-cp-4

A message that is not in the archive (sent off-list or not yet received): CAEaD8JMLztRbqmoqGByyWQficPKcDNM2sEyDEQwRF55s5KMYCg@mail.gmail.com

#4 lore raw
Quoted 46 lines · On Sat, Jul 11, 2020, 13:01 Vladimir 'phcoder' Serbinenko <[email protected]>…
Quoted 4 lines · On Fri, Jul 10, 2020, 11:19 朱光宏 <[email protected]> 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

Quoted 34 lines

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

Quoted 26 lines · On Thu, Jul 9, 2020, 15:11 GuangHong Zhu <[email protected]> wrote:
---
 util/grub-menulst2cfg.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
util/grub-menulst2cfg.c +3 -2
index a39f86939..6f7587347 100644
@@ -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