diff options
author | Ulrich Drepper <drepper@redhat.com> | 2001-03-30 16:52:30 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2001-03-30 16:52:30 +0000 |
commit | 220e7575011147416181092f718c07c914e6157f (patch) | |
tree | 038ee0c90b15218cd1c5760e789c7bd1db2db34d /posix/regex.c | |
parent | e25d31ef402e31b8b00190b7b19eabc8f7f25e31 (diff) | |
download | glibc-220e7575011147416181092f718c07c914e6157f.tar glibc-220e7575011147416181092f718c07c914e6157f.tar.gz glibc-220e7575011147416181092f718c07c914e6157f.tar.bz2 glibc-220e7575011147416181092f718c07c914e6157f.zip |
Avoid an access violation if malloc failes.
Diffstat (limited to 'posix/regex.c')
-rw-r--r-- | posix/regex.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/posix/regex.c b/posix/regex.c index e3aafbc03d..471d869899 100644 --- a/posix/regex.c +++ b/posix/regex.c @@ -2339,7 +2339,6 @@ regex_compile (pattern, size, syntax, bufp) #ifdef MBS_SUPPORT /* Initialize the wchar_t PATTERN and offset_buffer. */ p = pend = pattern = TALLOC(csize + 1, CHAR_TYPE); - pattern[csize] = L'\0'; /* sentinel */ mbs_offset = TALLOC(csize + 1, int); is_binary = TALLOC(csize + 1, char); if (pattern == NULL || mbs_offset == NULL || is_binary == NULL) @@ -2349,6 +2348,7 @@ regex_compile (pattern, size, syntax, bufp) free(is_binary); return REG_ESPACE; } + pattern[csize] = L'\0'; /* sentinel */ size = convert_mbs_to_wcs(pattern, cpattern, csize, mbs_offset, is_binary); pend = p + size; if (size < 0) |