diff options
author | Guido van Rossum <guido@python.org> | 1996-06-11 18:33:14 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1996-06-11 18:33:14 (GMT) |
commit | ab28c56fd39f0edc24e2765d5b69b7f7c21d9d71 (patch) | |
tree | e0e59f34378c6ca0d24d333346a615d5d00b31d4 /Modules/regexmodule.c | |
parent | 6602099e7c8eca0f3051d1e5bd92e634dd83ffd4 (diff) | |
download | cpython-ab28c56fd39f0edc24e2765d5b69b7f7c21d9d71.zip cpython-ab28c56fd39f0edc24e2765d5b69b7f7c21d9d71.tar.gz cpython-ab28c56fd39f0edc24e2765d5b69b7f7c21d9d71.tar.bz2 |
Avoid core dump on symcomp("").
Diffstat (limited to 'Modules/regexmodule.c')
-rw-r--r-- | Modules/regexmodule.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/regexmodule.c b/Modules/regexmodule.c index 893f4fc..33801af 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; } |