notepad: Dangling pointer fix

Andrew Talbot andrew.talbot at talbotville.com
Thu Oct 18 13:15:05 CDT 2007


Changelog:
    notepad: Dangling pointer fix.

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



More information about the wine-patches mailing list