regedit: Fix memory leak on error path in GetItemPath (scan-build).

This commit is contained in:
Alex Henrie 2023-06-07 22:46:35 -06:00 committed by Alexandre Julliard
parent 7b3690dd73
commit 6c1157435a

View file

@ -99,7 +99,10 @@ LPWSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY* phRootKey)
pathBuffer = malloc(maxLen * sizeof(WCHAR));
if (!pathBuffer) return NULL;
*pathBuffer = 0;
if (!get_item_path(hwndTV, hItem, phRootKey, &pathBuffer, &pathLen, &maxLen)) return NULL;
if (!get_item_path(hwndTV, hItem, phRootKey, &pathBuffer, &pathLen, &maxLen)) {
free(pathBuffer);
return NULL;
}
return pathBuffer;
}