Fixed missing NULL checks.
This commit is contained in:
parent
5a2c249749
commit
dd676c7b29
@ -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++)
|
||||
|
24
libfreerdp/cache/bitmap.c
vendored
24
libfreerdp/cache/bitmap.c
vendored
@ -304,8 +304,9 @@ 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;
|
||||
@ -314,10 +315,7 @@ rdpBitmapCache* bitmap_cache_new(rdpSettings* settings)
|
||||
sizeof(BITMAP_V2_CELL));
|
||||
|
||||
if (!bitmapCache->cells)
|
||||
{
|
||||
free(bitmapCache);
|
||||
return NULL;
|
||||
}
|
||||
goto fail;
|
||||
|
||||
for (i = 0; i < (int) bitmapCache->maxCells; i++)
|
||||
{
|
||||
@ -325,10 +323,22 @@ rdpBitmapCache* bitmap_cache_new(rdpSettings* settings)
|
||||
/* 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)
|
||||
|
Loading…
Reference in New Issue
Block a user