summaryrefslogtreecommitdiff
path: root/libguile/regex-posix.c
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2004-07-09 23:15:28 +0000
committerKevin Ryde <user42@zip.com.au>2004-07-09 23:15:28 +0000
commitf8fc973725fa6809820be1a8ccd0b713fd99917f (patch)
tree60717ec85f82c3864d338a1d0494fb09e5931070 /libguile/regex-posix.c
parent48a06bd55ded5ab29e34926bb09b573985793c62 (diff)
downloadguile-f8fc973725fa6809820be1a8ccd0b713fd99917f.tar.gz
(scm_make_regexp): Free rx on error, to avoid memory leak.
Diffstat (limited to 'libguile/regex-posix.c')
-rw-r--r--libguile/regex-posix.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libguile/regex-posix.c b/libguile/regex-posix.c
index 8792baf50..9a128bf42 100644
--- a/libguile/regex-posix.c
+++ b/libguile/regex-posix.c
@@ -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,9 +188,11 @@ SCM_DEFINE (scm_make_regexp, "make-regexp", 1, 0, 1,
cflags & ~REG_NOSUB);
if (status != 0)
{
+ char *errmsg = scm_regexp_error_msg (status, rx);
+ scm_gc_free (rx, sizeof(regex_t), "regex");
scm_error (scm_regexp_error_key,
FUNC_NAME,
- scm_regexp_error_msg (status, rx),
+ errmsg,
SCM_BOOL_F,
SCM_BOOL_F);
/* never returns */