Merge pull request #2028 from kormax/vas-memory-leak
Fix potential memory leak in VAS implementation
This commit is contained in:
1 file changed
+3
-2
@@ -187,18 +187,19 @@ static int LoadReaderPrivateKey(uint8_t *buf, size_t bufLen, mbedtls_ecp_keypair
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
tlvdb_free(derRoot);
|
||||
|
||||
if (mbedtls_ecp_point_read_binary(&privKey->grp, &privKey->Q, pubkeyCoordsTlv->value + 1, 65)) {
|
||||
PrintAndLogEx(FAILED, "Failed to read in public key coordinates");
|
||||
tlvdb_free(derRoot);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
if (mbedtls_ecp_check_pubkey(&privKey->grp, &privKey->Q)) {
|
||||
PrintAndLogEx(FAILED, "VAS protocol requires an elliptic key on the P-256 curve");
|
||||
tlvdb_free(derRoot);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
tlvdb_free(derRoot);
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user