Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e0cb9da

Browse files
Issue #25893: Removed unused variable reqdSize.
Added test for return code for the last RegQueryValueExW.
1 parent 3dc74bf commit e0cb9da

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

PC/getpathp.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,6 @@ getpythonregpath(HKEY keyBase, int skipcore)
321321
dataBuf = PyMem_RawMalloc((dataSize+1) * sizeof(WCHAR));
322322
if (dataBuf) {
323323
WCHAR *szCur = dataBuf;
324-
DWORD reqdSize = dataSize;
325324
/* Copy our collected strings */
326325
for (index=0;index<numKeys;index++) {
327326
if (index > 0) {
@@ -349,6 +348,10 @@ getpythonregpath(HKEY keyBase, int skipcore)
349348
*/
350349
rc = RegQueryValueExW(newKey, NULL, 0, NULL,
351350
(LPBYTE)szCur, &dataSize);
351+
if (rc != ERROR_SUCCESS) {
352+
PyMem_RawFree(dataBuf);
353+
goto done;
354+
}
352355
}
353356
/* And set the result - caller must free */
354357
retval = dataBuf;

0 commit comments

Comments
 (0)