Issue #13015: Fix a possible reference leak in defaultdict.__repr__.
Patch by Suman Saha.
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
index ea5f779..ccc3043 100644
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -1475,8 +1475,10 @@
     {
         int status = Py_ReprEnter(dd->default_factory);
         if (status != 0) {
-            if (status < 0)
+            if (status < 0) {
+                Py_DECREF(baserepr);
                 return NULL;
+            }
             defrepr = PyString_FromString("...");
         }
         else