Piotr Caban : comctl32: Fixed TreeView_EndEditLabelNow crash.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Mar 26 08:12:51 CDT 2007


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

Author: Piotr Caban <piotr.caban at gmail.com>
Date:   Sat Mar 24 10:53:49 2007 +0100

comctl32: Fixed TreeView_EndEditLabelNow crash.

---

 dlls/comctl32/treeview.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index 8ababc9..85e6f68 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -3793,7 +3793,8 @@ TREEVIEW_EndEditLabelNow(TREEVIEW_INFO *infoPtr, BOOL bCancel)
 
         if (strcmpW(newText, editedItem->pszText) != 0)
         {
-            if (NULL == ReAlloc(editedItem->pszText, iLength + 1))
+            WCHAR *ptr = ReAlloc(editedItem->pszText, sizeof(WCHAR)*(iLength + 1));
+            if (ptr == NULL)
             {
                 ERR("OutOfMemory, cannot allocate space for label\n");
                 DestroyWindow(infoPtr->hwndEdit);
@@ -3802,6 +3803,7 @@ TREEVIEW_EndEditLabelNow(TREEVIEW_INFO *infoPtr, BOOL bCancel)
             }
             else
             {
+                editedItem->pszText = ptr;
                 editedItem->cchTextMax = iLength + 1;
                 strcpyW(editedItem->pszText, newText);
             }




More information about the wine-cvs mailing list