Mike McCormack : riched20: Don't access memory after freeing it.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Nov 6 05:48:34 CST 2006


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

Author: Mike McCormack <mike at codeweavers.com>
Date:   Sun Nov  5 14:26:47 2006 +0900

riched20: Don't access memory after freeing it.

---

 dlls/riched20/editor.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index e8362f1..3cce1cf 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -1812,18 +1812,20 @@ LRESULT WINAPI RichEditANSIWndProc(HWND
     LPWSTR wszText = ME_ToUnicode(hWnd, (void *)lParam);
     size_t len = lstrlenW(wszText);
     TRACE("EM_REPLACESEL - %s\n", debugstr_w(wszText));
-    
+
     ME_GetSelection(editor, &from, &to);
     style = ME_GetSelectionInsertStyle(editor);
     ME_InternalDeleteText(editor, from, to-from);
     ME_InsertTextFromCursor(editor, 0, wszText, len, style);
     ME_ReleaseStyle(style);
-    ME_EndToUnicode(hWnd, wszText);
     /* drop temporary style if line end */
-    /* FIXME question: does abc\n mean: put abc, clear temp style, put \n? (would require a change) */  
+    /*
+     * FIXME question: does abc\n mean: put abc,
+     * clear temp style, put \n? (would require a change)
+     */
     if (len>0 && wszText[len-1] == '\n')
       ME_ClearTempStyle(editor);
-      
+    ME_EndToUnicode(hWnd, wszText);
     ME_CommitUndo(editor);
     if (!wParam)
       ME_EmptyUndoStack(editor);




More information about the wine-cvs mailing list