Merge pull request #2266 from kaleb-himes/ZD-5154

Check correct allocation assignment. Thanks to R.A. for the report on…
This commit is contained in:
David Garske
2019-06-04 10:22:09 -04:00
committed by GitHub

View File

@ -198,8 +198,10 @@ int wc_PBKDF2(byte* output, const byte* passwd, int pLen, const byte* salt,
if (buffer == NULL)
return MEMORY_E;
hmac = (Hmac*)XMALLOC(sizeof(Hmac), NULL, DYNAMIC_TYPE_HMAC);
if (buffer == NULL)
if (hmac == NULL) {
XFREE(buffer, NULL, DYNAMIC_TYPE_TMP_BUFFER);
return MEMORY_E;
}
#endif
ret = wc_HmacInit(hmac, NULL, INVALID_DEVID);