Skip to content

Commit c4aa408

Browse files
Add wc_Sha256Free after the final use
1 parent 91cbb64 commit c4aa408

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/agent.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ static int PostAddRsaId(WOLFSSH_AGENT_CTX* agent,
436436
ret = wc_Sha256Update(&sha, key, nSz + eSz + (LENGTH_SZ * 2));
437437
if (ret == 0)
438438
ret = wc_Sha256Final(&sha, id->id);
439+
wc_Sha256Free(&sha);
439440

440441
if (ret == 0)
441442
ret = WS_SUCCESS;
@@ -518,6 +519,7 @@ static int PostAddEcdsaId(WOLFSSH_AGENT_CTX* agent,
518519
curveNameSz + qSz + (LENGTH_SZ * 2));
519520
if (ret == 0)
520521
ret = wc_Sha256Final(&sha, id->id);
522+
wc_Sha256Free(&sha);
521523

522524
if (ret == 0)
523525
ret = WS_SUCCESS;
@@ -584,6 +586,7 @@ static int PostRemoveId(WOLFSSH_AGENT_CTX* agent,
584586
ret = wc_Sha256Update(&sha, keyBlob, keyBlobSz);
585587
if (ret == 0)
586588
ret = wc_Sha256Final(&sha, id);
589+
wc_Sha256Free(&sha);
587590
ret = (ret == 0) ? WS_SUCCESS : WS_CRYPTO_FAILED;
588591
}
589592

@@ -661,6 +664,7 @@ static WOLFSSH_AGENT_ID* FindKeyId(WOLFSSH_AGENT_ID* id,
661664
ret = wc_Sha256Final(&sha, digest);
662665
ret = (ret == 0) ? WS_SUCCESS : WS_CRYPTO_FAILED;
663666
}
667+
wc_Sha256Free(&sha);
664668

665669
if (ret == WS_SUCCESS) {
666670
while (id != NULL &&

0 commit comments

Comments
 (0)