summaryrefslogtreecommitdiff
path: root/Modules/regexmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-06-11 18:33:14 +0000
committerGuido van Rossum <guido@python.org>1996-06-11 18:33:14 +0000
commit1f3c12c9f1c0f960b3a50b2fa63cfae51018ba09 (patch)
tree450ad9b475696c9f648d43dfccdcb23b096db5a0 /Modules/regexmodule.c
parentc8841c43a1681004765db6acb4648c0c4dc7673e (diff)
downloadcpython-1f3c12c9f1c0f960b3a50b2fa63cfae51018ba09.tar.gz
Avoid core dump on symcomp("").
Diffstat (limited to 'Modules/regexmodule.c')
-rw-r--r--Modules/regexmodule.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/regexmodule.c b/Modules/regexmodule.c
index 893f4fc31b..33801afa90 100644
--- a/Modules/regexmodule.c
+++ b/Modules/regexmodule.c
@@ -398,6 +398,11 @@ symcomp(pattern, gdict)
object *npattern;
int require_escape = re_syntax & RE_NO_BK_PARENS ? 0 : 1;
+ if (oend == opat) {
+ INCREF(pattern);
+ return pattern;
+ }
+
npattern = newsizedstringobject((char*)NULL, getstringsize(pattern));
if (npattern == NULL)
return NULL;
@@ -466,7 +471,6 @@ symcomp(pattern, gdict)
if (resizestring(&npattern, n - getstringvalue(npattern)) == 0)
return npattern;
else {
- DECREF(npattern);
return NULL;
}