formats[index].formatName = NULL;
if ((formatId > CF_MAX) && formatName)
+ {
formats[index].formatName = _strdup(formatName);
+
+ if (!formats[index].formatName)
+ goto fail;
+ }
}
formatList.msgFlags = CB_RESPONSE_OK;
afc->serverFormats[index].formatName = NULL;
if (formatList->formats[index].formatName)
+ {
afc->serverFormats[index].formatName = _strdup(
formatList->formats[index].formatName);
+
+ if (!afc->serverFormats[index].formatName)
+ return CHANNEL_RC_NO_MEMORY;
+ }
}
for (index = 0; index < afc->numServerFormats; index++)
rdpBitmapCache* bitmapCache;
bitmapCache = (rdpBitmapCache*) calloc(1, sizeof(rdpBitmapCache));
- if (bitmapCache)
+ if (!bitmapCache)
+ return NULL;
+
+ bitmapCache->settings = settings;
+ bitmapCache->update = ((freerdp*) settings->instance)->update;
+ bitmapCache->context = bitmapCache->update->context;
+ bitmapCache->maxCells = settings->BitmapCacheV2NumCells;
+ bitmapCache->cells = (BITMAP_V2_CELL*) calloc(bitmapCache->maxCells,
+ sizeof(BITMAP_V2_CELL));
+
+ if (!bitmapCache->cells)
+ goto fail;
+
+ for (i = 0; i < (int) bitmapCache->maxCells; i++)
{
- bitmapCache->settings = settings;
- bitmapCache->update = ((freerdp*) settings->instance)->update;
- bitmapCache->context = bitmapCache->update->context;
- bitmapCache->maxCells = settings->BitmapCacheV2NumCells;
- bitmapCache->cells = (BITMAP_V2_CELL*) calloc(bitmapCache->maxCells,
- sizeof(BITMAP_V2_CELL));
-
- if (!bitmapCache->cells)
- {
- free(bitmapCache);
- return NULL;
- }
+ bitmapCache->cells[i].number = settings->BitmapCacheV2CellInfo[i].numEntries;
+ /* allocate an extra entry for BITMAP_CACHE_WAITING_LIST_INDEX */
+ bitmapCache->cells[i].entries = (rdpBitmap**) calloc((
+ bitmapCache->cells[i].number + 1), sizeof(rdpBitmap*));
- for (i = 0; i < (int) bitmapCache->maxCells; i++)
- {
- bitmapCache->cells[i].number = settings->BitmapCacheV2CellInfo[i].numEntries;
- /* allocate an extra entry for BITMAP_CACHE_WAITING_LIST_INDEX */
- bitmapCache->cells[i].entries = (rdpBitmap**) calloc((
- bitmapCache->cells[i].number + 1), sizeof(rdpBitmap*));
- }
+ if (!bitmapCache->cells[i].entries)
+ goto fail;
}
return bitmapCache;
+fail:
+
+ if (bitmapCache->cells)
+ {
+ for (i = 0; i < (int) bitmapCache->maxCells; i++)
+ free(bitmapCache->cells[i].entries);
+ }
+
+ free(bitmapCache);
+ return NULL;
}
void bitmap_cache_free(rdpBitmapCache* bitmapCache)