notepad: Fix some memory leaks

Andrew Talbot andrew.talbot at talbotville.com
Wed Oct 17 14:46:04 CDT 2007


Changelog:
    notepad: Fix some memory leaks.

diff --git a/programs/notepad/main.c b/programs/notepad/main.c
index 18500df..be75d76 100644
--- a/programs/notepad/main.c
+++ b/programs/notepad/main.c
@@ -398,18 +398,17 @@ void NOTEPAD_DoFind(FINDREPLACE *fr)
             found = StrStr(content+pos, fr->lpstrFindWhat);
             break;
         default:    /* shouldn't happen */
+            HeapFree(GetProcessHeap(), 0, content);
             return;
     }
-    HeapFree(GetProcessHeap(), 0, content);
 
-    if (found == NULL)
-    {
+    if (found)
+        SendMessage(Globals.hEdit, EM_SETSEL, found - content, found - content + len);
+    else
         DIALOG_StringMsgBox(Globals.hFindReplaceDlg, STRING_NOTFOUND, fr->lpstrFindWhat,
             MB_ICONINFORMATION|MB_OK);
-        return;
-    }
 
-    SendMessage(Globals.hEdit, EM_SETSEL, found - content, found - content + len);
+    HeapFree(GetProcessHeap(), 0, content);
 }
 
 /***********************************************************************



More information about the wine-patches mailing list