Jacek Cabanjack@itma.pwr.wroc.pl writes:
- if(chf16->lpTemplateName)
- {
len1 = strlen(MapSL(chf16->lpTemplateName));
chf32w->lpTemplateName = malloc(len1 * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, (LPSTR)MapSL(chf16->lpTemplateName),
len1, (LPWSTR)chf32w->lpTemplateName, len1);
- }
- if(chf16->lpszStyle)
- {
len2 = strlen(MapSL(chf16->lpszStyle));
chf32w->lpszStyle = malloc(len2 * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, (LPSTR)MapSL(chf16->lpTemplateName),
len2, chf32w->lpszStyle, len2);
- }
These strings never get freed (and please use HeapAlloc instead of malloc). Also the length arguments are wrong, you can't use strlen() to determine the size of the Unicode string. There are similar problems at other places in your patch too.