Hugh McMaster : regedit: Free allocated memory after calling GetValueName( ).

Alexandre Julliard julliard at winehq.org
Mon Jul 16 14:40:00 CDT 2018


Module: wine
Branch: master
Commit: a7a08e2927ec5b99b2f97fe2acffca4cdf0ef8d4
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=a7a08e2927ec5b99b2f97fe2acffca4cdf0ef8d4

Author: Hugh McMaster <hugh.mcmaster at outlook.com>
Date:   Mon Jul 16 12:20:46 2018 +0000

regedit: Free allocated memory after calling GetValueName().

Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/regedit/framewnd.c | 5 +++--
 programs/regedit/listview.c | 2 +-
 programs/regedit/main.h     | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/programs/regedit/framewnd.c b/programs/regedit/framewnd.c
index ed0c5bb..4d828c0 100644
--- a/programs/regedit/framewnd.c
+++ b/programs/regedit/framewnd.c
@@ -853,10 +853,11 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
     case ID_EDIT_MODIFY:
     case ID_EDIT_MODIFY_BIN:
     {
-        LPCWSTR valueName = GetValueName(g_pChildWnd->hListWnd);
-        WCHAR* keyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
+        WCHAR *valueName = GetValueName(g_pChildWnd->hListWnd);
+        WCHAR *keyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
         ModifyValue(hWnd, hKeyRoot, keyPath, valueName);
         heap_free(keyPath);
+        heap_free(valueName);
         break;
     }
     case ID_EDIT_FIND:
diff --git a/programs/regedit/listview.c b/programs/regedit/listview.c
index f42f9c2..7584828 100644
--- a/programs/regedit/listview.c
+++ b/programs/regedit/listview.c
@@ -63,7 +63,7 @@ LPWSTR GetItemText(HWND hwndLV, UINT item)
     return NULL;
 }
 
-LPCWSTR GetValueName(HWND hwndLV)
+WCHAR *GetValueName(HWND hwndLV)
 {
     INT item;
 
diff --git a/programs/regedit/main.h b/programs/regedit/main.h
index edcc901..ae03440 100644
--- a/programs/regedit/main.h
+++ b/programs/regedit/main.h
@@ -150,7 +150,7 @@ int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
 BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR highlightValue);
 HWND StartValueRename(HWND hwndLV);
 LPWSTR GetItemText(HWND hwndLV, UINT item);
-LPCWSTR GetValueName(HWND hwndLV);
+WCHAR *GetValueName(HWND hwndLV);
 BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result);
 BOOL IsDefaultValue(HWND hwndLV, int i);
 




More information about the wine-cvs mailing list