Marcus Meissner : regedit: Check HeapAlloc results (coverity).
Alexandre Julliard
julliard at winehq.org
Thu Jan 29 09:15:14 CST 2009
Module: wine
Branch: master
Commit: 1082779ddc55cec4f1a6e076140e109baf707502
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1082779ddc55cec4f1a6e076140e109baf707502
Author: Marcus Meissner <marcus at jet.franken.de>
Date: Thu Jan 29 08:47:42 2009 +0100
regedit: Check HeapAlloc results (coverity).
---
programs/regedit/listview.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/programs/regedit/listview.c b/programs/regedit/listview.c
index fb7688f..333b2a4 100644
--- a/programs/regedit/listview.c
+++ b/programs/regedit/listview.c
@@ -533,7 +533,12 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR highli
max_val_size++;
valName = HeapAlloc(GetProcessHeap(), 0, max_val_name_len * sizeof(WCHAR));
+ if (!valName)
+ goto done;
valBuf = HeapAlloc(GetProcessHeap(), 0, max_val_size);
+ if (!valBuf)
+ goto done;
+
if (RegQueryValueExW(hKey, NULL, NULL, &valType, valBuf, &valSize) == ERROR_FILE_NOT_FOUND) {
AddEntryToList(hwndLV, NULL, REG_SZ, NULL, 0, !highlightValue);
}
@@ -545,7 +550,7 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR highli
errCode = RegEnumValueW(hKey, index, valName, &valNameLen, NULL, &valType, valBuf, &valSize);
if (errCode != ERROR_SUCCESS) goto done;
valBuf[valSize] = 0;
- if (valName && highlightValue && !lstrcmpW(valName, highlightValue))
+ if (highlightValue && !lstrcmpW(valName, highlightValue))
bSelected = TRUE;
AddEntryToList(hwndLV, valName[0] ? valName : NULL, valType, valBuf, valSize, bSelected);
}
More information about the wine-cvs
mailing list