fixed buffer overflow
authorChristoph von Wittich <christoph_vw@reactos.org>
Mon, 17 Oct 2005 15:17:54 +0000 (15:17 +0000)
committerChristoph von Wittich <christoph_vw@reactos.org>
Mon, 17 Oct 2005 15:17:54 +0000 (15:17 +0000)
removed useless LocalUnlock
fixed memory leak

svn path=/trunk/; revision=18521

reactos/subsys/system/regedit/hexedit.c
reactos/subsys/system/regedit/listview.c
reactos/subsys/system/regedit/treeview.c

index dc231d4..4bf3ecc 100644 (file)
@@ -517,7 +517,7 @@ HEXEDIT_WM_NCDESTROY(PHEXEDIT_DATA hed)
 {
   if(hed->hBuffer)
   {
-    while(LocalUnlock(hed->hBuffer));
+    //while(LocalUnlock(hed->hBuffer));
     LocalFree(hed->hBuffer);
   }
 
index 84094bb..c88e26d 100644 (file)
@@ -223,7 +223,7 @@ static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType, void* ValB
                 LPTSTR strBinary;
                 if(dwCount > 0)
                 {
-                    strBinary = HeapAlloc(GetProcessHeap(), 0, (dwCount * sizeof(TCHAR) * 3) + 1);
+                    strBinary = HeapAlloc(GetProcessHeap(), 0, (dwCount * sizeof(TCHAR) * 3) + sizeof(TCHAR));
                     for (i = 0; i < dwCount; i++)
                     {
                         wsprintf( strBinary + i*3, _T("%02X "), pData[i] );
index 8f7544f..418ef8e 100644 (file)
@@ -181,9 +181,9 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
         goto done;
     }
     tvItem.cchTextMax = dwMaxSubKeyLen;
-    if (!(tvItem.pszText = HeapAlloc(GetProcessHeap(), 0, dwMaxSubKeyLen * sizeof(TCHAR)))) {
+    /*if (!(tvItem.pszText = HeapAlloc(GetProcessHeap(), 0, dwMaxSubKeyLen * sizeof(TCHAR)))) {
         goto done;
-    }
+    }*/
 
     /* Get all of the tree node siblings in one contiguous block of memory */
     {