From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: gnutls memory leak [Was: Re: Emacs bzr memory footprint] Date: Wed, 26 Oct 2011 22:52:21 +0800 Message-ID: <87k47rx0t6.fsf_-_@gnu.org> References: <83fwix2osa.fsf@gnu.org> <0B3EE7A4-D0D6-4D1E-ADC4-0BEE68F179B2@mit.edu> <87fwivwp37.fsf@turtle.gmx.de> <87sjmvpmd2.fsf@lifelogs.com> <87aa93wmc4.fsf@turtle.gmx.de> <87sjmnrdjw.fsf@spindle.srvr.nix> <87ty73mc0m.fsf@spindle.srvr.nix> <87mxcp2cv0.fsf@spindle.srvr.nix> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1319640775 28439 80.91.229.12 (26 Oct 2011 14:52:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 26 Oct 2011 14:52:55 +0000 (UTC) Cc: Nix , John Wiegley , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 26 16:52:49 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RJ4qR-0001A7-76 for ged-emacs-devel@m.gmane.org; Wed, 26 Oct 2011 16:52:43 +0200 Original-Received: from localhost ([::1]:60510 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJ4qQ-00028N-8b for ged-emacs-devel@m.gmane.org; Wed, 26 Oct 2011 10:52:42 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:37642) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJ4qN-00020O-Cb for emacs-devel@gnu.org; Wed, 26 Oct 2011 10:52:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RJ4qG-0006Rx-CY for emacs-devel@gnu.org; Wed, 26 Oct 2011 10:52:39 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]:38807) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJ4qG-0006Rt-B7 for emacs-devel@gnu.org; Wed, 26 Oct 2011 10:52:32 -0400 Original-Received: from bb116-14-207-132.singnet.com.sg ([116.14.207.132]:56780 helo=furball) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1RJ4qE-00050M-Dy; Wed, 26 Oct 2011 10:52:31 -0400 In-Reply-To: (Stefan Monnier's message of "Tue, 25 Oct 2011 16:23:10 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.10 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:145575 Archived-At: I think I see a problem in gnutls.c. The functions for freeing the credentials structures, fn_gnutls_certificate_free_credentials (x509_cred); fn_gnutls_anon_free_client_credentials (anon_cred); are only called at gnutls.c:761 and gnutls.c:767, specifically for the case where Fgnutls_boot is called on a process that already has credentials structures (gnutls_x509_cred or gnutls_anon_cred) allocated. IIUC, those freeing functions don't get called when the process is killed via kill-process. Could someone who had a hand in gnutls.c check if this is accurate? If not, I can try to put together a patch. BTW, does anyone know a simple test-case for using the gnutls support, to make it easier to test for the leak?