merge 3.2
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 3c1d3a1..3971062 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2091,8 +2091,10 @@
                  PyUnicode_CompareWithASCIIString(tmp, "__weakref__") == 0))
                 continue;
             tmp =_Py_Mangle(name, tmp);
-            if (!tmp)
+            if (!tmp) {
+                Py_DECREF(newslots);
                 goto bad_slots;
+            }
             PyList_SET_ITEM(newslots, j, tmp);
             if (PyDict_GetItem(dict, tmp)) {
                 PyErr_Format(PyExc_ValueError,