From: Kevin Ryde <user42@zip.com.au>
Subject: make-regexp error memory leak
Date: Mon, 05 Jul 2004 09:51:39 +1000 [thread overview]
Message-ID: <87pt7bpbzo.fsf@zip.com.au> (raw)
[-- Attachment #1: Type: text/plain, Size: 305 bytes --]
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.
[-- Attachment #2: regex-posix.c.free-cvs.diff --]
[-- Type: text/plain, Size: 648 bytes --]
--- 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),
[-- Attachment #3: regex-posix.c.free-16.diff --]
[-- Type: text/plain, Size: 677 bytes --]
--- 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),
[-- Attachment #4: Type: text/plain, Size: 143 bytes --]
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
next reply other threads:[~2004-07-04 23:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-04 23:51 Kevin Ryde [this message]
2004-07-07 17:41 ` make-regexp error memory leak Rob Browning
2004-07-08 23:57 ` Kevin Ryde
2004-07-09 18:03 ` Rob Browning
2004-07-10 0:05 ` Kevin Ryde
2004-07-11 18:37 ` Rob Browning
2004-07-23 23:06 ` Kevin Ryde
2004-07-27 1:56 ` Rob Browning
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
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pt7bpbzo.fsf@zip.com.au \
--to=user42@zip.com.au \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).