From 4278c670d18d35966b430f9131a48767df35b2c9 Mon Sep 17 00:00:00 2001 From: Lionel Debroux Date: Mon, 3 Sep 2007 14:59:55 +0200 Subject: [PATCH] regedit: Fixed a memory leak in listview.c (found by Smatch). --- programs/regedit/listview.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/programs/regedit/listview.c b/programs/regedit/listview.c index 0e4b52bd949..8b58eece4f8 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; + } do { ListView_GetItemText(hwndLV, item, 0, curStr, maxLen); if (_tcslen(curStr) < maxLen - 1) return curStr;