mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
(scm_make_regexp): Free rx on error, to avoid memory leak.
This commit is contained in:
parent
48a06bd55d
commit
f8fc973725
1 changed files with 4 additions and 2 deletions
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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);
|
cflags & ~REG_NOSUB);
|
||||||
if (status != 0)
|
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,
|
scm_error (scm_regexp_error_key,
|
||||||
FUNC_NAME,
|
FUNC_NAME,
|
||||||
scm_regexp_error_msg (status, rx),
|
errmsg,
|
||||||
SCM_BOOL_F,
|
SCM_BOOL_F,
|
||||||
SCM_BOOL_F);
|
SCM_BOOL_F);
|
||||||
/* never returns */
|
/* never returns */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue