all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: lu4nx <lx@shellcodes.org>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] * lib-src/etags.c: Free variables.
Date: Fri, 09 Dec 2022 17:30:42 +0200	[thread overview]
Message-ID: <83ilikzja5.fsf@gnu.org> (raw)
In-Reply-To: <tencent_1470CC602ECE9219F21AC89AA13B08F9C807@qq.com> (message from lu4nx on Fri, 9 Dec 2022 23:03:04 +0800)

> 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.



  reply	other threads:[~2022-12-09 15:30 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 [this message]
2022-12-09 15:35   ` lux

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=83ilikzja5.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=lx@shellcodes.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.