diff src/DLD-FUNCTIONS/regexp.cc @ 5760:8d7162924bd3

[project @ 2006-04-14 04:01:37 by jwe]
author jwe
date Fri, 14 Apr 2006 04:01:40 +0000
parents 0225507842a1
children 7ba9ad1fec11
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/regexp.cc	Thu Apr 13 13:04:33 2006 +0000
+++ b/src/DLD-FUNCTIONS/regexp.cc	Fri Apr 14 04:01:40 2006 +0000
@@ -313,18 +313,10 @@
       if (err)
 	{
 	  int len = regerror(err, &compiled, NULL, 0);
-	  char *errmsg = (char *)malloc(len);
-	  if (errmsg)
-	    {
-	      regerror(err, &compiled, errmsg, len);
-	      error("%s: %s in pattern (%s)", nm.c_str(), errmsg, 
-		    pattern.c_str());
-	      free(errmsg);
-	    }
-	  else
-	    {
-	      error("out of memory");
-	    }
+	  OCTAVE_LOCAL_BUFFER (char, errmsg, len);
+	  regerror(err, &compiled, errmsg, len);
+	  error("%s: %s in pattern (%s)", nm.c_str(), errmsg, 
+		pattern.c_str());
 	  regfree(&compiled);
 	  return retval;
 	}