]> granicus.if.org Git - python/commitdiff
Issue #25893: Removed unused variable reqdSize.
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 18 Dec 2015 07:54:19 +0000 (09:54 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Fri, 18 Dec 2015 07:54:19 +0000 (09:54 +0200)
Added test for return code for the last RegQueryValueExW.

PC/getpathp.c

index 25b328b260c10bb8f76c866b08eb91a9d089ca2b..c7ddf1ea6b33eb6d55457eab82f9802a2512b0cd 100644 (file)
@@ -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;