More ReAlloc fixes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With this patch, all *ReAlloc* places have been audited
and, where necessary, fixed.

We now have to fix all there realloc funcs to not allocate
memory (where appropriate).

ChangeLog
    {Global,Local}ReAlloc() does not allocate memory.

Index: dlls/ole32/ifs.c
===================================================================
RCS file: /var/cvs/wine/dlls/ole32/ifs.c,v
retrieving revision 1.31
diff -u -r1.31 ifs.c
--- dlls/ole32/ifs.c	11 Sep 2003 03:06:25 -0000	1.31
+++ dlls/ole32/ifs.c	25 Nov 2003 08:03:12 -0000
@@ -73,7 +73,8 @@
 /* resize the old table */
 static int SetSpyedBlockTableLength ( int NewLength )
 {
-        Malloc32.SpyedBlocks = (LPVOID*)LocalReAlloc((HLOCAL)Malloc32.SpyedBlocks, NewLength, GMEM_ZEROINIT);
+	if (!Malloc32.SpyedBlocks) Malloc32.SpyedBlocks = (LPVOID*)LocalAlloc(NewLength, GMEM_ZEROINIT);
+        else Malloc32.SpyedBlocks = (LPVOID*)LocalReAlloc((HLOCAL)Malloc32.SpyedBlocks, NewLength, GMEM_ZEROINIT);
         Malloc32.SpyedBlockTableLength = NewLength;
         return Malloc32.SpyedBlocks ? 1 : 0;
 }
Index: dlls/shell32/shell32_main.c
===================================================================
RCS file: /var/cvs/wine/dlls/shell32/shell32_main.c,v
retrieving revision 1.126
diff -u -r1.126 shell32_main.c
--- dlls/shell32/shell32_main.c	18 Nov 2003 19:50:24 -0000	1.126
+++ dlls/shell32/shell32_main.c	25 Nov 2003 07:47:04 -0000
@@ -92,15 +92,15 @@
 
     if (*lpCmdline==0) {
         /* Return the path to the executable */
-        DWORD size;
+        DWORD size=16;
 
-        hargv=0;
-        size=16;
-        do {
+        hargv=GlobalAlloc(size, 0);
+	argv=GlobalLock(hargv);
+	while (GetModuleFileNameW(0, (LPWSTR)(argv+1), size-sizeof(LPWSTR)) == 0) {
             size*=2;
             hargv=GlobalReAlloc(hargv, size, 0);
             argv=GlobalLock(hargv);
-        } while (GetModuleFileNameW(0, (LPWSTR)(argv+1), size-sizeof(LPWSTR)) == 0);
+        }
         argv[0]=(LPWSTR)(argv+1);
         if (numargs)
             *numargs=2;


-- 
Dimi.



[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux