On Sat, Jul 11, 2020, 13:01 Vladimir 'phcoder' Serbinenko <phco...@gmail.com> wrote:
> > > On Fri, Jul 10, 2020, 11:19 朱光宏 <zhuguangh...@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 code > >> >> free already checks for nullness of its argument. Any reason for this >> patch? >> >> >> On Thu, Jul 9, 2020, 15:11 GuangHong Zhu <zhuguangh...@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 >>> >>> >>> >>> >>>
_______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel