winex11.drv: Cast-qual warning fix + remove superfluous HeapFree()

Andrew Talbot Andrew.Talbot at talbotville.com
Sat Nov 25 06:41:26 CST 2006


Changelog:
    winex11.drv: Cast-qual warning fix + remove superfluous HeapFree().

diff -urN a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c
--- a/dlls/winex11.drv/clipboard.c	2006-10-09 20:06:04.000000000 +0100
+++ b/dlls/winex11.drv/clipboard.c	2006-11-25 12:37:27.000000000 +0000
@@ -511,7 +511,8 @@
 {
     LPWINE_CLIPFORMAT lpFormat;
     LPWINE_CLIPFORMAT lpNewFormat;
-   
+    LPWSTR new_name;
+
     /* allocate storage for new format entry */
     lpNewFormat = HeapAlloc(GetProcessHeap(), 0, sizeof(WINE_CLIPFORMAT));
 
@@ -521,14 +522,13 @@
         return NULL;
     }
 
-    if (!(lpNewFormat->Name = HeapAlloc(GetProcessHeap(), 0, (strlenW(FormatName)+1)*sizeof(WCHAR))))
+    if (!(new_name = HeapAlloc(GetProcessHeap(), 0, (strlenW(FormatName)+1)*sizeof(WCHAR))))
     {
         WARN("No more memory for the new format name!\n");
-        HeapFree(GetProcessHeap(), 0, lpNewFormat);
         return NULL;
     }
 
-    strcpyW((LPWSTR)lpNewFormat->Name, FormatName);
+    lpNewFormat->Name = strcpyW(new_name, FormatName);
     lpNewFormat->wFlags = 0;
     lpNewFormat->wFormatID = GlobalAddAtomW(lpNewFormat->Name);
     lpNewFormat->drvData = prop;



More information about the wine-patches mailing list