mirror of https://github.com/FreeRDP/FreeRDP
Merge pull request #2728 from bmiklautz/unsigned
Fix possible endless loops on cleanup.
This commit is contained in:
commit
a4c9a7f604
|
@ -107,10 +107,9 @@ static BOOL update_message_BitmapUpdate(rdpContext* context, BITMAP_UPDATE* bitm
|
|||
wParam->rectangles[index].bitmapDataStream = (BYTE*) malloc(wParam->rectangles[index].bitmapLength);
|
||||
if (!wParam->rectangles[index].bitmapDataStream)
|
||||
{
|
||||
for (index -= 1; index >= 0; --index)
|
||||
{
|
||||
free(wParam->rectangles[index].bitmapDataStream);
|
||||
}
|
||||
while(index)
|
||||
free(wParam->rectangles[--index].bitmapDataStream);
|
||||
|
||||
free(wParam->rectangles);
|
||||
free(wParam);
|
||||
return FALSE;
|
||||
|
|
|
@ -755,8 +755,9 @@ rdpSettings* freerdp_settings_clone(rdpSettings* settings)
|
|||
_settings->TargetNetAddresses[index] = _strdup(settings->TargetNetAddresses[index]);
|
||||
if (!_settings->TargetNetAddresses[index])
|
||||
{
|
||||
for (--index; index >= 0; --index)
|
||||
free(_settings->TargetNetAddresses[index]);
|
||||
while(index)
|
||||
free(_settings->TargetNetAddresses[--index]);
|
||||
|
||||
free(_settings->TargetNetAddresses);
|
||||
_settings->TargetNetAddresses = NULL;
|
||||
_settings->TargetNetAddressCount = 0;
|
||||
|
|
|
@ -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;
|
||||
|
@ -374,9 +374,12 @@ BOOL ClipboardInitFormats(wClipboard* clipboard)
|
|||
|
||||
if (!format->formatName)
|
||||
{
|
||||
for (--formatId; formatId >= 0; --formatId)
|
||||
int i;
|
||||
for (i = formatId-1; i >= 0; --i)
|
||||
{
|
||||
format = &(clipboard->formats[--clipboard->numFormats]);
|
||||
free((void *)format->formatName);
|
||||
clipboard->numFormats = 0;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue