clipboard: fix of by one error on cleanup

This commit is contained in:
Bernhard Miklautz 2015-06-25 11:53:03 +02:00
parent 28e63786cd
commit cbbc680131

View File

@ -364,9 +364,9 @@ BOOL ClipboardInitFormats(wClipboard* clipboard)
if (!clipboard)
return FALSE;
for (formatId = 0; formatId < CF_MAX; formatId++)
for (formatId = 0; formatId < CF_MAX; formatId++, clipboard->numFormats++)
{
format = &(clipboard->formats[clipboard->numFormats++]);
format = &(clipboard->formats[clipboard->numFormats]);
ZeroMemory(format, sizeof(wClipboardFormat));
format->formatId = formatId;
@ -375,7 +375,7 @@ BOOL ClipboardInitFormats(wClipboard* clipboard)
if (!format->formatName)
{
int i;
for(i = formatId-1; i >= 0; --i)
for (i = formatId-1; i >= 0; --i)
{
format = &(clipboard->formats[--clipboard->numFormats]);
free((void *)format->formatName);