From 28e63786cdeed6745d6cda352296becd12f077b5 Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Thu, 25 Jun 2015 10:33:54 +0200 Subject: [PATCH] Integrate pull request feedback Use while instead of for with additional variable where appropriate. --- libfreerdp/core/message.c | 5 ++--- libfreerdp/core/settings.c | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/libfreerdp/core/message.c b/libfreerdp/core/message.c index 2c8f8e829..adc0e0f49 100644 --- a/libfreerdp/core/message.c +++ b/libfreerdp/core/message.c @@ -107,9 +107,8 @@ 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) { - UINT32 i; - for (i = 0; i < index; ++i) - free(wParam->rectangles[i].bitmapDataStream); + while(index) + free(wParam->rectangles[--index].bitmapDataStream); free(wParam->rectangles); free(wParam); diff --git a/libfreerdp/core/settings.c b/libfreerdp/core/settings.c index f038efebc..4b5dbde29 100644 --- a/libfreerdp/core/settings.c +++ b/libfreerdp/core/settings.c @@ -755,9 +755,9 @@ rdpSettings* freerdp_settings_clone(rdpSettings* settings) _settings->TargetNetAddresses[index] = _strdup(settings->TargetNetAddresses[index]); if (!_settings->TargetNetAddresses[index]) { - UINT32 i; - for (i = 0; i < index; ++i) - free(_settings->TargetNetAddresses[i]); + while(index) + free(_settings->TargetNetAddresses[--index]); + free(_settings->TargetNetAddresses); _settings->TargetNetAddresses = NULL; _settings->TargetNetAddressCount = 0;