[Python-checkins] cpython (2.7): Closes #20908: Memory leak in Reg2Py()

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


http://hg.python.org/cpython/rev/b44a3f6676b8
changeset: 89636:b44a3f6676b8
branch: 2.7
parent: 89620:1763e27a182d
user: Jesus Cea <jcea at jcea.es>
date: Thu Mar 13 17:33:43 2014 +0100
summary:
 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
@@ -948,8 +948,10 @@
 
 fixupMultiSZ(str, retDataBuf, retDataSize);
 obData = PyList_New(s);
- if (obData == NULL)
+ if (obData == NULL) {
+ free(str);
 return NULL;
+ }
 for (index = 0; index < s; index++)
 {
 size_t len = _mbstrlen(str[index]);
@@ -957,6 +959,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 によって変換されたページ (->オリジナル) /