summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--PC/getpathp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/PC/getpathp.c b/PC/getpathp.c
index 25b328b..c7ddf1e 100644
--- a/PC/getpathp.c
+++ b/PC/getpathp.c
@@ -321,7 +321,6 @@ getpythonregpath(HKEY keyBase, int skipcore)
dataBuf = PyMem_RawMalloc((dataSize+1) * sizeof(WCHAR));
if (dataBuf) {
WCHAR *szCur = dataBuf;
- DWORD reqdSize = dataSize;
/* Copy our collected strings */
for (index=0;index<numKeys;index++) {
if (index > 0) {
@@ -349,6 +348,10 @@ getpythonregpath(HKEY keyBase, int skipcore)
*/
rc = RegQueryValueExW(newKey, NULL, 0, NULL,
(LPBYTE)szCur, &dataSize);
+ if (rc != ERROR_SUCCESS) {
+ PyMem_RawFree(dataBuf);
+ goto done;
+ }
}
/* And set the result - caller must free */
retval = dataBuf;