From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: YAMAMOTO Mitsuharu Newsgroups: gmane.emacs.bugs Subject: bug#32604: 26.1.50; memory leak in connect_network_socket Date: Sat, 1 Sep 2018 14:38:51 +0900 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1535780289 21042 195.159.176.226 (1 Sep 2018 05:38:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 1 Sep 2018 05:38:09 +0000 (UTC) To: 32604@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Sep 01 07:38:05 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fvybk-0005No-5r for geb-bug-gnu-emacs@m.gmane.org; Sat, 01 Sep 2018 07:38:04 +0200 Original-Received: from localhost ([::1]:59615 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvydq-0000kp-F5 for geb-bug-gnu-emacs@m.gmane.org; Sat, 01 Sep 2018 01:40:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55347) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvydj-0000kX-M8 for bug-gnu-emacs@gnu.org; Sat, 01 Sep 2018 01:40:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvyde-0007XW-Mh for bug-gnu-emacs@gnu.org; Sat, 01 Sep 2018 01:40:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36142) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fvyde-0007XR-Ik for bug-gnu-emacs@gnu.org; Sat, 01 Sep 2018 01:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fvyde-0004M7-CK for bug-gnu-emacs@gnu.org; Sat, 01 Sep 2018 01:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: YAMAMOTO Mitsuharu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Sep 2018 05:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 32604 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.153578036016683 (code B ref -1); Sat, 01 Sep 2018 05:40:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Sep 2018 05:39:20 +0000 Original-Received: from localhost ([127.0.0.1]:41159 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fvycx-0004Kz-Dz for submit@debbugs.gnu.org; Sat, 01 Sep 2018 01:39:19 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:34269) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fvycv-0004Km-Es for submit@debbugs.gnu.org; Sat, 01 Sep 2018 01:39:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvycn-0007EL-TG for submit@debbugs.gnu.org; Sat, 01 Sep 2018 01:39:11 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:49476) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fvycm-0007E4-Qo for submit@debbugs.gnu.org; Sat, 01 Sep 2018 01:39:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvycl-0000gp-Rw for bug-gnu-emacs@gnu.org; Sat, 01 Sep 2018 01:39:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvycg-00079s-Sl for bug-gnu-emacs@gnu.org; Sat, 01 Sep 2018 01:39:07 -0400 Original-Received: from mathmail.math.s.chiba-u.ac.jp ([133.82.132.2]:59784) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvycg-00076Z-Bn for bug-gnu-emacs@gnu.org; Sat, 01 Sep 2018 01:39:02 -0400 Original-Received: from [192.168.33.40] (mitsu.math.s.chiba-u.ac.jp [133.82.132.19]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTPSA id 91044F08EB for ; Sat, 1 Sep 2018 14:38:53 +0900 (JST) (envelope-from mituharu@math.s.chiba-u.ac.jp) X-Mailer: Apple Mail (2.3273) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:149936 Archived-At: In connect_network_socket (in process.c), the memory pointed to by the variable `sa=E2=80=99 doesn=E2=80=99t seem to be deallocated. 3328 struct sockaddr *sa =3D NULL; : 3347 while (!NILP (addrinfos)) 3348 { : 3359 if (sa) 3360 free (sa); 3361 sa =3D xmalloc (addrlen); : 3533 } : The following patch would fix the leak: diff --git a/src/process.c b/src/process.c index 676f38446e..e5b70ca058 100644 --- a/src/process.c +++ b/src/process.c @@ -3576,6 +3576,8 @@ connect_network_socket (Lisp_Object proc, = Lisp_Object addrinfos, #endif } =20 + xfree (sa); + if (s < 0) { const char *err =3D (p->is_server Also, line 3359-3361 above could be: sa =3D xrealloc (addrlen); YAMAMOTO Mitsuharu mituharu@math.s.chiba-u.ac.jp In GNU Emacs 26.1.50 (build 1, x86_64-apple-darwin16.7.0) of 2018-09-01 built on YAMAMOTO-no-iMac-5K.local Repository revision: ac7936cb8f4d4d6706535bfcea0d97741c2ca15f Windowing system distributor 'The X.Org Foundation', version = 11.0.11804000 Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Configured using: 'configure --without-ns --without-x-toolkit --without-gnutls --with-jpeg=3Dno --with-gif=3Dno --with-tiff=3Dno PKG_CONFIG=3D/opt/local/bin/pkg-config = PKG_CONFIG_PATH=3D/usr/lib/pkgconfig:/opt/X11/lib/pkgconfig:/usr/local/lib= /pkgconfig PKG_CONFIG_LIBDIR=3D --enable-checking=3Dyes,glyphs --enable-check-lisp-object-type CFLAGS=3D-g' Configured features: XPM PNG NOTIFY ACL LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB OLDXMENU X11 XDBE XIM THREADS Important settings: value of $LANG: ja_JP.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair time-date mule-util japan-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads kqueue dynamic-setting font-render-setting x multi-tty make-network-process emacs) Memory information: ((conses 16 97309 7262) (symbols 48 20210 2) (miscs 40 64 126) (strings 32 28170 1559) (string-bytes 1 745551) (vectors 16 14728) (vector-slots 8 572806 12294) (floats 8 54 90) (intervals 56 261 13) (buffers 992 12))