about summary refs log tree commit diff
path: root/posix/regexec.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2010-01-22 10:39:59 -0800
committerUlrich Drepper <drepper@redhat.com>2010-01-22 10:39:59 -0800
commitd044d844dd011bb26317ac36da2d22ebe19621b1 (patch)
treef5c0c2f5d3d5dd5a1c4f9d8cf89240419481b592 /posix/regexec.c
parent5ddf954cf19d43f54ba44f487427d210952e1236 (diff)
downloadglibc-d044d844dd011bb26317ac36da2d22ebe19621b1.tar.gz
glibc-d044d844dd011bb26317ac36da2d22ebe19621b1.tar.xz
glibc-d044d844dd011bb26317ac36da2d22ebe19621b1.zip
regexec.c: simplify re_search_2_stub
Diffstat (limited to 'posix/regexec.c')
-rw-r--r--posix/regexec.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/posix/regexec.c b/posix/regexec.c
index b8db74062b..c7d0b37ef5 100644
--- a/posix/regexec.c
+++ b/posix/regexec.c
@@ -368,7 +368,7 @@ re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs,
   const char *str;
   int rval;
   int len = length1 + length2;
-  int free_str = 0;
+  char *s = NULL;
 
   if (BE (length1 < 0 || length2 < 0 || stop < 0, 0))
     return -2;
@@ -377,7 +377,7 @@ re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs,
   if (length2 > 0)
     if (length1 > 0)
       {
-	char *s = re_malloc (char, len);
+	s = re_malloc (char, len);
 
 	if (BE (s == NULL, 0))
 	  return -2;
@@ -388,17 +388,14 @@ re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs,
 	memcpy (s + length1, string2, length2);
 #endif
 	str = s;
-	free_str = 1;
       }
     else
       str = string2;
   else
     str = string1;
 
-  rval = re_search_stub (bufp, str, len, start, range, stop, regs,
-			 ret_len);
-  if (free_str)
-    re_free ((char *) str);
+  rval = re_search_stub (bufp, str, len, start, range, stop, regs, ret_len);
+  re_free (s);
   return rval;
 }