1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-12-24 17:51:17 +03:00

* posix/regcomp.c (re_comp): Call __regfree on re_comp_buf.

(free_mem): New function.
	* posix/Makefile (tests): Add bug-regex14.  Add bug-regex14-mem
	if not cross compiling.
	(generated): Add bug-regex14-mem and bug-regex14.mtrace.
	(bug-regex14-ENV): Set.
	(bug-regex14-mem): New target.
	* posix/bug-regex14.c: New file.

	* elf/Makefile ($(objpfx)librtld.map): Use temporary file for output
	target, so we don't touch it when the link fails.
This commit is contained in:
Roland McGrath
2002-10-24 00:22:27 +00:00
parent 3efdabe762
commit 240e87c230
5 changed files with 102 additions and 5 deletions

View File

@@ -653,6 +653,7 @@ re_comp (s)
const char *s;
{
reg_errcode_t ret;
char *fastmap;
if (!s)
{
@@ -661,7 +662,17 @@ re_comp (s)
return 0;
}
if (!re_comp_buf.buffer)
if (re_comp_buf.buffer)
{
fastmap = re_comp_buf.fastmap;
re_comp_buf.fastmap = NULL;
__regfree (&re_comp_buf);
re_comp_buf.buffer = NULL;
re_comp_buf.allocated = 0;
re_comp_buf.fastmap = fastmap;
}
if (re_comp_buf.fastmap == NULL)
{
re_comp_buf.fastmap = (char *) malloc (SBC_MAX);
if (re_comp_buf.fastmap == NULL)
@@ -683,6 +694,16 @@ re_comp (s)
/* Yes, we're discarding `const' here if !HAVE_LIBINTL. */
return (char *) gettext (__re_error_msgid + __re_error_msgid_idx[(int) ret]);
}
#ifdef _LIBC
static void __attribute__ ((unused))
free_mem (void)
{
__regfree (&re_comp_buf);
}
text_set_element (__libc_subfreeres, free_mem);
#endif
#endif /* _REGEX_RE_COMP */
/* Internal entry point.