diff options
Diffstat (limited to 'Objects/stringobject.c')
-rw-r--r-- | Objects/stringobject.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c index 7675f7e..4c28500 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -2713,9 +2713,9 @@ str_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return NULL; assert(PyString_Check(tmp)); new = type->tp_alloc(type, n = PyString_GET_SIZE(tmp)); - if (new == NULL) - return NULL; - memcpy(PyString_AS_STRING(new), PyString_AS_STRING(tmp), n+1); + if (new != NULL) + memcpy(PyString_AS_STRING(new), PyString_AS_STRING(tmp), n+1); + Py_DECREF(tmp); return new; } |