Kaydet (Commit) 29d55a38 authored tarafından Guido van Rossum's avatar Guido van Rossum

Fix a memory leak in str_subtype_new(). (All the other

xxx_subtype_new() functions are OK, but I goofed up in this one. :-( )
üst bfa47b07
...@@ -2713,9 +2713,9 @@ str_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) ...@@ -2713,9 +2713,9 @@ str_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return NULL; return NULL;
assert(PyString_Check(tmp)); assert(PyString_Check(tmp));
new = type->tp_alloc(type, n = PyString_GET_SIZE(tmp)); new = type->tp_alloc(type, n = PyString_GET_SIZE(tmp));
if (new == NULL) if (new != NULL)
return NULL; memcpy(PyString_AS_STRING(new), PyString_AS_STRING(tmp), n+1);
memcpy(PyString_AS_STRING(new), PyString_AS_STRING(tmp), n+1); Py_DECREF(tmp);
return new; return new;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment