From: lux <lx@shellcodes.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] * lib-src/etags.c: Free variables.
Date: Fri, 9 Dec 2022 23:35:42 +0800 [thread overview]
Message-ID: <tencent_C80DA7E7CC5F0D674DD51D877C4D386EB006@qq.com> (raw)
In-Reply-To: <83ilikzja5.fsf@gnu.org>
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.
prev parent reply other threads:[~2022-12-09 15:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-09 15:03 [PATCH] * lib-src/etags.c: Free variables lu4nx
2022-12-09 15:30 ` Eli Zaretskii
2022-12-09 15:35 ` lux [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tencent_C80DA7E7CC5F0D674DD51D877C4D386EB006@qq.com \
--to=lx@shellcodes.org \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.