]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Closes #20908: Memory leak in Reg2Py()
authorJesus Cea <jcea@jcea.es>
Thu, 13 Mar 2014 16:35:32 +0000 (17:35 +0100)
committerJesus Cea <jcea@jcea.es>
Thu, 13 Mar 2014 16:35:32 +0000 (17:35 +0100)
PC/winreg.c

index 3b9693cc6a76a310749dc1b0c253355821de4913..3347eb7c4a0ccf32d1abedd79eac93b0f693b4a2 100644 (file)
@@ -943,8 +943,10 @@ Reg2Py(BYTE *retDataBuf, DWORD retDataSize, DWORD typ)
 
                 fixupMultiSZ(str, data, len);
                 obData = PyList_New(s);
-                if (obData == NULL)
+                if (obData == NULL) {
+                    free(str);
                     return NULL;
+                }
                 for (index = 0; index < s; index++)
                 {
                     size_t len = wcslen(str[index]);
@@ -952,6 +954,7 @@ Reg2Py(BYTE *retDataBuf, DWORD retDataSize, DWORD typ)
                         PyErr_SetString(PyExc_OverflowError,
                             "registry string is too long for a Python string");
                         Py_DECREF(obData);
+                        free(str);
                         return NULL;
                     }
                     PyList_SetItem(obData,