all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: mituharu@math.s.chiba-u.ac.jp
Cc: 32604@debbugs.gnu.org
Subject: bug#32604: 26.1.50; memory leak in connect_network_socket
Date: Tue, 04 Sep 2018 19:19:48 -0400	[thread overview]
Message-ID: <87muswhmuj.fsf@gmail.com> (raw)
In-Reply-To: <0aad35d46cfe7a15d67484205d19340c.squirrel@weber.math.s.chiba-u.ac.jp> (mituharu's message of "Mon, 3 Sep 2018 15:02:00 +0900")

Looks good to me; a couple of minor suggestions below.

mituharu@math.s.chiba-u.ac.jp writes:

> @@ -3322,6 +3322,7 @@ connect_network_socket (Lisp_Object proc,
> Lisp_Object addrinfos,
>                          Lisp_Object use_external_socket_p)
>  {
>    ptrdiff_t count = SPECPDL_INDEX ();
> +  ptrdiff_t count1 UNINIT;
>    int s = -1, outch, inch;
>    int xerrno = 0;
>    int family;
> @@ -3344,6 +3345,9 @@ connect_network_socket (Lisp_Object proc,
> Lisp_Object addrinfos,
>    /* Do this in case we never enter the while-loop below.  */
>    s = -1;
>
> +  record_unwind_protect_nothing ();
> +  count1 = SPECPDL_INDEX ();

Since we assume a C99 compiler now, you could just do

    ptrdiff_t count1 = SPECPDL_INDEX ();

without having the UNINIT thing.  Also, since free is harmless on a NULL
pointer, you could just record an unwind protect at the top once,
without having the nothing state, I think.





  reply	other threads:[~2018-09-04 23:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-01  5:38 bug#32604: 26.1.50; memory leak in connect_network_socket YAMAMOTO Mitsuharu
2018-09-01  5:46 ` YAMAMOTO Mitsuharu
2018-09-02 17:55 ` Noam Postavsky
2018-09-03  6:02   ` mituharu
2018-09-04 23:19     ` Noam Postavsky [this message]
2018-09-05 23:50       ` YAMAMOTO Mitsuharu
2018-09-06  0:04         ` Noam Postavsky
2018-09-06 23:41           ` YAMAMOTO Mitsuharu

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=87muswhmuj.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=32604@debbugs.gnu.org \
    --cc=mituharu@math.s.chiba-u.ac.jp \
    /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.