Skip to content

Commit

Permalink
Fix qat_BN_to_FB() to reset the flatbuffer length to zero on a failed…
Browse files Browse the repository at this point in the history
… allocation.

Change-Id: I350e6c5ea8304768eb58d523bad3e1f0440ad471
Signed-off-by: Steve Linsell <stevenx.linsell@intel.com>
  • Loading branch information
stevelinsell committed Jan 23, 2018
1 parent 728e37b commit d0fbc6f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion qat_asym_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ int qat_BN_to_FB(CpaFlatBuffer * fb, const BIGNUM *bn)
/* Memory allocate for flat buffer */
fb->dataLenInBytes = (Cpa32U) BN_num_bytes(bn);
if (0 == fb->dataLenInBytes) {
fb->dataLenInBytes = 0;
fb->pData = NULL;
DEBUG("Datalen = 0, zero byte memory allocation\n");
return 1;
}
fb->pData = qaeCryptoMemAlloc(fb->dataLenInBytes, __FILE__, __LINE__);
if (NULL == fb->pData) {
fb->dataLenInBytes = 0;
WARN("Failed to allocate fb->pData\n");
return 0;
}
Expand Down

0 comments on commit d0fbc6f

Please sign in to comment.