On Sat, 2006-11-25 at 12:41 +0000, Andrew Talbot wrote:
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;
Just out of curiosity. Why is the HeapFree superfluous? It is allocated a few lines above and not free-ed in this fail condition.
Cheers,
Paul.
Paul Vriens wrote:
Just out of curiosity. Why is the HeapFree superfluous? It is allocated a few lines above and not free-ed in this fail condition.
Cheers,
Paul.
Hi Paul,
The fail condition is that no memory was available, therefore, what is there to free?
-- Andy.
On Sat, 2006-11-25 at 14:01 +0000, Andrew Talbot wrote:
Paul Vriens wrote:
Just out of curiosity. Why is the HeapFree superfluous? It is allocated a few lines above and not free-ed in this fail condition.
Cheers,
Paul.
Hi Paul,
The fail condition is that no memory was available, therefore, what is there to free?
-- Andy.
Hi Andy,
the failing allocation was for lpNewFormat->Name. The freeing was for lpNewFormat on line 516 (original).
Cheers,
Paul.
Hi Andy,
the failing allocation was for lpNewFormat->Name. The freeing was for lpNewFormat on line 516 (original).
Cheers,
Paul.
Whoops! You're right. Thank you for pointing it out; I shall post a "please ignore" to wine-patches.
-- Andy.