From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.lisp.guile.devel Subject: readlink, getcwd memory leaks Date: Fri, 26 Mar 2004 06:12:16 +1000 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <877jx8hejj.fsf@zip.com.au> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1080245933 17402 80.91.224.253 (25 Mar 2004 20:18:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 25 Mar 2004 20:18:53 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Mar 25 21:18:39 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1B6bJH-0001I0-00 for ; Thu, 25 Mar 2004 21:18:39 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B6bEr-0004kY-1s for guile-devel@m.gmane.org; Thu, 25 Mar 2004 15:14:05 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1B6bER-0004kP-VD for guile-devel@gnu.org; Thu, 25 Mar 2004 15:13:39 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1B6bDv-0004gv-1a for guile-devel@gnu.org; Thu, 25 Mar 2004 15:13:38 -0500 Original-Received: from [61.8.0.84] (helo=mailout1.pacific.net.au) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B6bDu-0004g1-0K for guile-devel@gnu.org; Thu, 25 Mar 2004 15:13:06 -0500 Original-Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.0.87]) by mailout1.pacific.net.au (8.12.3/8.12.3/Debian-6.6) with ESMTP id i2PKCx4u001316 for ; Fri, 26 Mar 2004 07:12:59 +1100 Original-Received: from localhost (ppp20.dyn10.pacific.net.au [61.8.10.20]) by mailproxy2.pacific.net.au (8.12.3/8.12.3/Debian-6.6) with ESMTP id i2PKCUsg015020 for ; Fri, 26 Mar 2004 07:12:52 +1100 Original-Received: from gg by localhost with local (Exim 3.36 #1 (Debian)) id 1B6bD7-0000XM-00; Fri, 26 Mar 2004 06:12:17 +1000 Original-To: guile-devel@gnu.org Mail-Copies-To: never User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:3572 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:3572 --=-=-= * filesys.c (scm_getcwd, scm_readlink): Avoid memory leak on errors. Unbounded growth can be seen with (while #t (false-if-exception (readlink "nosuchfile"))) and (mkdir "somedir") (chdir "somedir") (rmdir "../somedir") (while #t (false-if-exception (getcwd))) This will be for the 1.6 branch too I think. --=-=-= Content-Disposition: inline; filename=filesys.c.leak.diff --- filesys.c.~1.119.~ 2003-05-30 08:40:07.000000000 +1000 +++ filesys.c 2004-03-25 14:16:28.000000000 +1000 @@ -1,4 +1,4 @@ -/* Copyright (C) 1996,1997,1998,1999,2000,2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1996,1997,1998,1999,2000,2001, 2002, 2004 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -929,7 +929,12 @@ wd = scm_malloc (size); } if (rv == 0) - SCM_SYSERROR; + { + int save_errno = errno; + free (wd); + errno = save_errno; + SCM_SYSERROR; + } result = scm_mem2string (wd, strlen (wd)); free (wd); return result; @@ -1349,7 +1354,12 @@ buf = scm_malloc (size); } if (rv == -1) - SCM_SYSERROR; + { + int save_errno = errno; + free (buf); + errno = save_errno; + SCM_SYSERROR; + } result = scm_mem2string (buf, rv); free (buf); return result; --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel --=-=-=--