Fixed missing NULL checks.

This commit is contained in:
Armin Novak 2016-10-04 08:54:42 +02:00
parent 5a2c249749
commit dd676c7b29
2 changed files with 40 additions and 20 deletions

View File

@ -70,7 +70,12 @@ UINT android_cliprdr_send_client_format_list(CliprdrClientContext* cliprdr)
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;
@ -245,8 +250,13 @@ static UINT android_cliprdr_server_format_list(CliprdrClientContext* cliprdr,
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++)

View File

@ -304,31 +304,41 @@ rdpBitmapCache* bitmap_cache_new(rdpSettings* settings)
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));
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)
{
free(bitmapCache);
return NULL;
}
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)