* cygheap.cc (cwcsdup): Fix allocation size to accommodate sizeof WCHAR.

(cwcsdup1): Ditto.
This commit is contained in:
Corinna Vinschen 2010-04-13 10:01:34 +00:00
parent 098f9c6e48
commit 2bba259eb7
2 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2010-04-13 John Bowman <bowman@math.ualberta.ca>
* cygheap.cc (cwcsdup): Fix allocation size to accommodate sizeof WCHAR.
(cwcsdup1): Ditto.
2010-04-12 Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/version.h: Bump DLL minor version number to 5.

View File

@ -363,7 +363,7 @@ extern "C" PWCHAR __stdcall
cwcsdup (const PWCHAR s)
{
MALLOC_CHECK;
PWCHAR p = (PWCHAR) cmalloc (HEAP_STR, wcslen (s) + 1);
PWCHAR p = (PWCHAR) cmalloc (HEAP_STR, (wcslen (s) + 1) * sizeof (WCHAR));
if (!p)
return NULL;
wcpcpy (p, s);
@ -375,7 +375,7 @@ extern "C" PWCHAR __stdcall
cwcsdup1 (const PWCHAR s)
{
MALLOC_CHECK;
PWCHAR p = (PWCHAR) cmalloc (HEAP_1_STR, wcslen (s) + 1);
PWCHAR p = (PWCHAR) cmalloc (HEAP_1_STR, (wcslen (s) + 1) * sizeof (WCHAR));
if (!p)
return NULL;
wcpcpy (p, s);