Nikolay Sivov : shell32: Fix string leak.

Alexandre Julliard julliard at winehq.org
Mon Apr 24 16:11:22 CDT 2017


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sun Apr 23 18:29:08 2017 +0300

shell32: Fix string leak.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/shell32/autocomplete.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c
index 543e012..1a02c83 100644
--- a/dlls/shell32/autocomplete.c
+++ b/dlls/shell32/autocomplete.c
@@ -99,7 +99,6 @@ static inline IAutoCompleteImpl *impl_from_IAutoCompleteDropDown(IAutoCompleteDr
 static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
     IAutoCompleteImpl *This = GetPropW(hwnd, autocomplete_propertyW);
-    LPOLESTR strs;
     HRESULT hr;
     WCHAR hwndText[255];
     WCHAR *hwndQCText;
@@ -222,7 +221,9 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
             IEnumString_Reset(This->enumstr);
             filled = FALSE;
             for(cpt = 0;;) {
+                LPOLESTR strs = NULL;
                 ULONG fetched;
+
                 hr = IEnumString_Next(This->enumstr, 1, &strs, &fetched);
                 if (hr != S_OK)
                     break;
@@ -235,8 +236,10 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
                         strcatW(buffW, &strs[len]);
                         SetWindowTextW(hwnd, buffW);
                         SendMessageW(hwnd, EM_SETSEL, len, strlenW(strs));
-                        if (!(This->options & ACO_AUTOSUGGEST))
+                        if (!(This->options & ACO_AUTOSUGGEST)) {
+                            CoTaskMemFree(strs);
                             break;
+                        }
                     }
 
                     if (This->options & ACO_AUTOSUGGEST) {
@@ -246,6 +249,8 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
 
                     filled = TRUE;
                 }
+
+                CoTaskMemFree(strs);
             }
 
             if (This->options & ACO_AUTOSUGGEST) {




More information about the wine-cvs mailing list