Re: regedit: fixed a memory leak in listview.c (found by Smatch).
3 Sep
2007
3 Sep
'07
9:10 a.m.
"Lionel_Debroux" <lionel_debroux(a)yahoo.fr> wrote:
diff --git a/programs/regedit/listview.c b/programs/regedit/listview.c index 0e4b52b..8b58eec 100644 --- a/programs/regedit/listview.c +++ b/programs/regedit/listview.c @@ -61,7 +61,10 @@ static LPTSTR get_item_text(HWND hwndLV, int item)
curStr = HeapAlloc(GetProcessHeap(), 0, maxLen); if (!curStr) return NULL; - if (item == 0) return NULL; /* first item is ALWAYS a default */ + if (item == 0) { /* first item is ALWAYS a default */ + HeapFree(GetProcessHeap(), 0, curStr); + return NULL; + }
A more logical fix would be to move if (item == 0) return NULL; /* first item is ALWAYS a default */ before HeapAlloc() call. -- Dmitry.
6672
Age (days ago)
6672
Last active (days ago)
0 comments
1 participants
participants (1)
-
Dmitry Timoshkov