emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] * lib-src/etags.c: Free variables.


From: lux
Subject: Re: [PATCH] * lib-src/etags.c: Free variables.
Date: Fri, 9 Dec 2022 23:35:42 +0800

On Fri, 09 Dec 2022 17:30:42 +0200
Eli Zaretskii <eliz@gnu.org> wrote:

> > From: lu4nx <lx@shellcodes.org>
> > Cc: lu4nx <lx@shellcodes.org>
> > Date: Fri,  9 Dec 2022 23:03:04 +0800
> > 
> > ---
> >  lib-src/etags.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/lib-src/etags.c b/lib-src/etags.c
> > index a06c236140..0822882d46 100644
> > --- a/lib-src/etags.c
> > +++ b/lib-src/etags.c
> > @@ -1339,6 +1339,8 @@ main (int argc, char **argv)
> >                        "AND read file names from it");
> >               while (readline_internal (&filename_lb, stdin,
> > "-", false) > 0) process_file_name (filename_lb.buffer, lang);
> > +
> > +                  free (filename_lb.buffer);
> >             }
> >           else
> >             process_file_name (this_file, lang);
> > @@ -1375,6 +1377,7 @@ main (int argc, char **argv)
> >       while (nincluded_files-- > 0)
> >         fprintf (tagf, "\f\n%s,include\n", *included_files++);
> >  
> > +          free (*included_files);
> >       if (fclose (tagf) == EOF)
> >         pfatal (tagfile);
> >     }
> > @@ -1400,6 +1403,8 @@ main (int argc, char **argv)
> >        append_to_tagfile = true;
> >      }
> >  
> > +  free (argbuffer);
> > +
> >    tagf = fopen (tagfile, append_to_tagfile ? "ab" : "wb");
> >    if (tagf == NULL)
> >      pfatal (tagfile);  
> 
> What is the rationale for these changes?  If a variable is not used
> until the program exits, there's no need to free it.
> 

Ok, thanks, just added it by the way when reviewing the code.




reply via email to

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