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: make-regexp error memory leak Date: Mon, 05 Jul 2004 09:51:39 +1000 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <87pt7bpbzo.fsf@zip.com.au> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1088985155 23395 80.91.224.253 (4 Jul 2004 23:52:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 4 Jul 2004 23:52:35 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Jul 05 01:52:28 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BhGma-0008NY-00 for ; Mon, 05 Jul 2004 01:52:28 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BhGoW-0003xd-Fx for guile-devel@m.gmane.org; Sun, 04 Jul 2004 19:54:28 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BhGoN-0003xX-Ae for guile-devel@gnu.org; Sun, 04 Jul 2004 19:54:19 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BhGoL-0003xL-Pr for guile-devel@gnu.org; Sun, 04 Jul 2004 19:54:19 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BhGoL-0003xI-Ns for guile-devel@gnu.org; Sun, 04 Jul 2004 19:54:17 -0400 Original-Received: from [61.8.0.85] (helo=mailout2.pacific.net.au) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BhGlt-0008D4-Mp for guile-devel@gnu.org; Sun, 04 Jul 2004 19:51:46 -0400 Original-Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.0.86]) by mailout2.pacific.net.au (8.12.3/8.12.3/Debian-6.6) with ESMTP id i64Npi5v020412 for ; Mon, 5 Jul 2004 09:51:44 +1000 Original-Received: from localhost (ppp2B88.dyn.pacific.net.au [61.8.43.136]) by mailproxy1.pacific.net.au (8.12.3/8.12.3/Debian-6.6) with ESMTP id i64Nphan023099 for ; Mon, 5 Jul 2004 09:51:43 +1000 Original-Received: from gg by localhost with local (Exim 3.36 #1 (Debian)) id 1BhGln-0000gs-00; Mon, 05 Jul 2004 09:51:39 +1000 Original-To: guile-devel@gnu.org Mail-Copies-To: never User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 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:3830 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:3830 --=-=-= When make-regexp throws an error it leaks memory, eg (while #t (false-if-exception (make-regexp "["))) I'm looking at the changes below for the cvs and for 1.6, I think they get the mallocated counting right. * regex-posix.c (scm_make_regexp): Free rx on error, to avoid memory leak. --=-=-= Content-Disposition: attachment; filename=regex-posix.c.free-cvs.diff --- regex-posix.c.~1.62.~ 2003-04-07 08:05:25.000000000 +1000 +++ regex-posix.c 2004-07-04 18:56:03.000000000 +1000 @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 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 @@ -188,6 +188,7 @@ cflags & ~REG_NOSUB); if (status != 0) { + scm_gc_free (rx, sizeof(regex_t), "regex"); scm_error (scm_regexp_error_key, FUNC_NAME, scm_regexp_error_msg (status, rx), --=-=-= Content-Disposition: attachment; filename=regex-posix.c.free-16.diff --- regex-posix.c.~1.53.2.3.~ 2002-03-14 15:26:15.000000000 +1000 +++ regex-posix.c 2004-07-04 18:57:30.000000000 +1000 @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2004 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -210,6 +210,8 @@ cflags & ~REG_NOSUB); if (status != 0) { + free (rx); + scm_done_free (sizeof (regex_t)); scm_error (scm_regexp_error_key, FUNC_NAME, scm_regexp_error_msg (status, rx), --=-=-= 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://lists.gnu.org/mailman/listinfo/guile-devel --=-=-=--