--- pcre_compile.c	2015/08/14 09:34:32	1593
+++ pcre_compile.c	2015/08/21 16:08:33	1594
@@ -7238,7 +7238,7 @@
           encountered. In that case, we allow yet more memory, just in case. 
           (Again, this is fixed "properly" in PCRE2. */
           
-          if (cd->dupgroups) *lengthptr += 2 + 2*LINK_SIZE;
+          if (cd->dupgroups) *lengthptr += 4 + 4*LINK_SIZE;
 
           /* Otherwise, check for recursion here. The name table does not exist
           in the first pass; instead we must scan the list of names encountered
@@ -9474,7 +9474,7 @@
 "const" attribute if the cast (pcre_uchar *)codestart is used directly in the
 function call. */
 
-if ((options & PCRE_NO_AUTO_POSSESS) == 0)
+if (errorcode == 0 && (options & PCRE_NO_AUTO_POSSESS) == 0)
   {
   pcre_uchar *temp = (pcre_uchar *)codestart;
   auto_possessify(temp, utf, cd);
