mirror of https://github.com/FreeRDP/FreeRDP
[warnings] fix portability [cm]alloc size 0
This commit is contained in:
parent
31ef07ead7
commit
ae95b66922
|
@ -857,6 +857,7 @@ static BOOL xf_clipboard_copy_formats(xfClipboard* clipboard, const CLIPRDR_FORM
|
|||
WINPR_ASSERT(formats || (numFormats == 0));
|
||||
|
||||
xf_clipboard_formats_free(clipboard);
|
||||
if (numFormats > 0)
|
||||
clipboard->lastSentFormats = calloc(numFormats, sizeof(CLIPRDR_FORMAT));
|
||||
if (!clipboard->lastSentFormats)
|
||||
return FALSE;
|
||||
|
|
|
@ -221,6 +221,9 @@ static BOOL freerdp_assistance_crypt_derive_key_sha1(const BYTE* hash, size_t ha
|
|||
BYTE pad1[64] = { 0 };
|
||||
BYTE pad2[64] = { 0 };
|
||||
|
||||
if (hashLength == 0)
|
||||
return FALSE;
|
||||
|
||||
memset(pad1, 0x36, sizeof(pad1));
|
||||
memset(pad2, 0x5C, sizeof(pad2));
|
||||
|
||||
|
|
|
@ -1219,7 +1219,9 @@ static BOOL license_rc4_with_licenseKey(const rdpLicense* license, const BYTE* i
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
BYTE* buffer = (BYTE*)realloc(target->data, len);
|
||||
BYTE* buffer = NULL;
|
||||
if (len > 0)
|
||||
buffer = realloc(target->data, len);
|
||||
if (!buffer)
|
||||
goto error_buffer;
|
||||
|
||||
|
@ -1468,7 +1470,9 @@ BOOL license_read_binary_blob_data(LICENSE_BLOB* blob, UINT16 wBlobType, const v
|
|||
}
|
||||
|
||||
blob->type = wBlobType;
|
||||
blob->data = (BYTE*)malloc(blob->length);
|
||||
blob->data = NULL;
|
||||
if (blob->length > 0)
|
||||
blob->data = malloc(blob->length);
|
||||
if (!blob->data)
|
||||
{
|
||||
WLog_ERR(TAG, "license binary blob::length=%" PRIu16 ", blob::data=%p", blob->length,
|
||||
|
|
Loading…
Reference in New Issue