Misc bugs found by using valgrind

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

 



Changelog:
  Fixed use of uninitialized memory and wrong buffersize (found by valgrind).


  Michael

--- dlls/avifil32/api.c.SAV	2003-09-20 16:14:45.000000000 +0200
+++ dlls/avifil32/api.c	2003-09-20 14:46:10.000000000 +0200
@@ -1009,7 +1009,7 @@
   szFilter[0] = 0;
   szFilter[1] = 0;
 
-  wszFilter = (LPWSTR)GlobalAllocPtr(GHND, cbFilter);
+  wszFilter = (LPWSTR)GlobalAllocPtr(GHND, cbFilter * sizeof(WCHAR));
   if (wszFilter == NULL)
     return AVIERR_MEMORY;
 
--- dlls/kernel/profile.c.~1.2.~	2003-09-07 23:33:00.000000000 +0200
+++ dlls/kernel/profile.c	2003-09-20 15:06:51.000000000 +0200
@@ -1221,7 +1221,8 @@
     LPWSTR bufferW;
     INT retW, ret = 0;
 
-    bufferW = buffer ? HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)) : NULL;
+    bufferW = (buffer ? HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
+				  len * sizeof(WCHAR)) : NULL);
     if (section) RtlCreateUnicodeStringFromAsciiz(&sectionW, section);
     else sectionW.Buffer = NULL;
     if (filename) RtlCreateUnicodeStringFromAsciiz(&filenameW, filename);
--- dlls/user/message.c.~1.45.~	2003-09-16 13:25:43.000000000 +0200
+++ dlls/user/message.c	2003-09-20 14:51:57.000000000 +0200
@@ -2166,6 +2166,7 @@
     TRACE( "hwnd %p msg %x (%s) wp %x lp %lx\n",
            hwnd, msg, SPY_GetMsgName(msg, hwnd), wparam, lparam );
 
+    memset(&info, 0, sizeof(info));
     info.type   = MSG_POSTED;
     info.hwnd   = hwnd;
     info.msg    = msg;
@@ -2211,6 +2212,7 @@
     }
     if (USER_IsExitingThread( thread )) return TRUE;
 
+    memset(&info, 0, sizeof(info));
     info.type   = MSG_POSTED;
     info.hwnd   = 0;
     info.msg    = msg;

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

  Powered by Linux