closes bpo-41533: Fix a potential memory leak when allocating a stack (GH-21847)

Free the stack allocated in va_build_stack if do_mkstack fails
and the stack is not a small_stack
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-08-12-20-29-57.bpo-41533.4pcVAc.rst b/Misc/NEWS.d/next/Core and Builtins/2020-08-12-20-29-57.bpo-41533.4pcVAc.rst
new file mode 100644
index 0000000..e166f0c
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2020-08-12-20-29-57.bpo-41533.4pcVAc.rst
@@ -0,0 +1,2 @@
+Free the stack allocated in ``va_build_stack`` if ``do_mkstack`` fails and
+the stack is not a ``small_stack``.
diff --git a/Python/modsupport.c b/Python/modsupport.c
index 2637039..2dabcf3 100644
--- a/Python/modsupport.c
+++ b/Python/modsupport.c
@@ -622,6 +622,9 @@
     va_end(lva);
 
     if (res < 0) {
+        if (stack != small_stack) {
+            PyMem_Free(stack);
+        }
         return NULL;
     }