[Python-checkins] cpython (merge 3.3 -> default): MERGE: Closes #20908: Memory leak in Reg2Py()

jesus.cea python-checkins at python.org
Thu Mar 13 17:38:43 CET 2014


http://hg.python.org/cpython/rev/227405961789
changeset: 89638:227405961789
parent: 89635:d575398d1916
parent: 89637:07968254be96
user: Jesus Cea <jcea at jcea.es>
date: Thu Mar 13 17:38:20 2014 +0100
summary:
 MERGE: Closes #20908: Memory leak in Reg2Py()
files:
 PC/winreg.c | 5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/PC/winreg.c b/PC/winreg.c
--- a/PC/winreg.c
+++ b/PC/winreg.c
@@ -943,8 +943,10 @@
 
 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 @@
 PyErr_SetString(PyExc_OverflowError,
 "registry string is too long for a Python string");
 Py_DECREF(obData);
+ free(str);
 return NULL;
 }
 PyList_SetItem(obData,
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /