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);
|
wParam->rectangles[index].bitmapDataStream = (BYTE*) malloc(wParam->rectangles[index].bitmapLength);
|
||||||
if (!wParam->rectangles[index].bitmapDataStream)
|
if (!wParam->rectangles[index].bitmapDataStream)
|
||||||
{
|
{
|
||||||
for (index -= 1; index >= 0; --index)
|
while(index)
|
||||||
{
|
free(wParam->rectangles[--index].bitmapDataStream);
|
||||||
free(wParam->rectangles[index].bitmapDataStream);
|
|
||||||
}
|
|
||||||
free(wParam->rectangles);
|
free(wParam->rectangles);
|
||||||
free(wParam);
|
free(wParam);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -755,8 +755,9 @@ rdpSettings* freerdp_settings_clone(rdpSettings* settings)
|
||||||
_settings->TargetNetAddresses[index] = _strdup(settings->TargetNetAddresses[index]);
|
_settings->TargetNetAddresses[index] = _strdup(settings->TargetNetAddresses[index]);
|
||||||
if (!_settings->TargetNetAddresses[index])
|
if (!_settings->TargetNetAddresses[index])
|
||||||
{
|
{
|
||||||
for (--index; index >= 0; --index)
|
while(index)
|
||||||
free(_settings->TargetNetAddresses[index]);
|
free(_settings->TargetNetAddresses[--index]);
|
||||||
|
|
||||||
free(_settings->TargetNetAddresses);
|
free(_settings->TargetNetAddresses);
|
||||||
_settings->TargetNetAddresses = NULL;
|
_settings->TargetNetAddresses = NULL;
|
||||||
_settings->TargetNetAddressCount = 0;
|
_settings->TargetNetAddressCount = 0;
|
||||||
|
|
|
@ -364,9 +364,9 @@ BOOL ClipboardInitFormats(wClipboard* clipboard)
|
||||||
if (!clipboard)
|
if (!clipboard)
|
||||||
return FALSE;
|
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));
|
ZeroMemory(format, sizeof(wClipboardFormat));
|
||||||
|
|
||||||
format->formatId = formatId;
|
format->formatId = formatId;
|
||||||
|
@ -374,9 +374,12 @@ BOOL ClipboardInitFormats(wClipboard* clipboard)
|
||||||
|
|
||||||
if (!format->formatName)
|
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);
|
free((void *)format->formatName);
|
||||||
clipboard->numFormats = 0;
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue