mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 10:37:23 -07:00
fix mem leaks
This commit is contained in:
parent
972f8590e0
commit
8c6312e209
1 changed files with 13 additions and 5 deletions
|
@ -253,6 +253,7 @@ int CmdEMVGPO(const char *cmd) {
|
|||
|
||||
// calc PDOL
|
||||
struct tlv *pdol_data_tlv = NULL;
|
||||
struct tlvdb *tmp_ext = NULL;
|
||||
struct tlv data_tlv = {
|
||||
.tag = 0x83,
|
||||
.len = datalen,
|
||||
|
@ -266,7 +267,7 @@ int CmdEMVGPO(const char *cmd) {
|
|||
ParamLoadFromJson(tlvRoot);
|
||||
};
|
||||
|
||||
struct tlvdb *tmp_ext = tlvdb_external(0x9f38, datalen, data);
|
||||
tmp_ext = tlvdb_external(0x9f38, datalen, data);
|
||||
pdol_data_tlv = dol_process((const struct tlv *)tmp_ext, tlvRoot, 0x83);
|
||||
if (!pdol_data_tlv){
|
||||
PrintAndLogEx(ERR, "Can't create PDOL TLV.");
|
||||
|
@ -285,8 +286,8 @@ int CmdEMVGPO(const char *cmd) {
|
|||
unsigned char *pdol_data_tlv_data = tlv_encode(pdol_data_tlv, &pdol_data_tlv_data_len);
|
||||
if (!pdol_data_tlv_data) {
|
||||
PrintAndLogEx(ERR, "Can't create PDOL data.");
|
||||
tlvdb_free(tmp_ext);
|
||||
tlvdb_free(tlvRoot);
|
||||
free(pdol_data_tlv);
|
||||
return 4;
|
||||
}
|
||||
PrintAndLogEx(INFO, "PDOL data[%d]: %s", pdol_data_tlv_data_len, sprint_hex(pdol_data_tlv_data, pdol_data_tlv_data_len));
|
||||
|
@ -299,7 +300,8 @@ int CmdEMVGPO(const char *cmd) {
|
|||
|
||||
if (pdol_data_tlv != &data_tlv)
|
||||
free(pdol_data_tlv);
|
||||
|
||||
|
||||
tlvdb_free(tmp_ext);
|
||||
tlvdb_free(tlvRoot);
|
||||
|
||||
if (sw)
|
||||
|
@ -434,6 +436,7 @@ int CmdEMVAC(const char *cmd) {
|
|||
|
||||
// calc CDOL
|
||||
struct tlv *cdol_data_tlv = NULL;
|
||||
struct tlvdb *tmp_ext = NULL;
|
||||
struct tlv data_tlv = {
|
||||
.tag = 0x01,
|
||||
.len = datalen,
|
||||
|
@ -448,7 +451,7 @@ int CmdEMVAC(const char *cmd) {
|
|||
ParamLoadFromJson(tlvRoot);
|
||||
};
|
||||
|
||||
struct tlvdb *tmp_ext = tlvdb_external(0x8c, datalen, data);
|
||||
tmp_ext = tlvdb_external(0x8c, datalen, data);
|
||||
cdol_data_tlv = dol_process((const struct tlv *)tmp_ext, tlvRoot, 0x01); // 0x01 - dummy tag
|
||||
if (!cdol_data_tlv){
|
||||
PrintAndLogEx(ERR, "Can't create CDOL TLV.");
|
||||
|
@ -473,6 +476,8 @@ int CmdEMVAC(const char *cmd) {
|
|||
|
||||
if (cdol_data_tlv != &data_tlv)
|
||||
free(cdol_data_tlv);
|
||||
|
||||
tlvdb_free(tmp_ext);
|
||||
tlvdb_free(tlvRoot);
|
||||
|
||||
if (sw)
|
||||
|
@ -578,6 +583,7 @@ int CmdEMVInternalAuthenticate(const char *cmd) {
|
|||
|
||||
// calc DDOL
|
||||
struct tlv *ddol_data_tlv = NULL;
|
||||
struct tlvdb *tmp_ext = NULL;
|
||||
struct tlv data_tlv = {
|
||||
.tag = 0x01,
|
||||
.len = datalen,
|
||||
|
@ -592,7 +598,7 @@ int CmdEMVInternalAuthenticate(const char *cmd) {
|
|||
ParamLoadFromJson(tlvRoot);
|
||||
};
|
||||
|
||||
struct tlvdb *tmp_ext = tlvdb_external(0x9f49, datalen, data);
|
||||
tmp_ext = tlvdb_external(0x9f49, datalen, data);
|
||||
ddol_data_tlv = dol_process((const struct tlv *)tmp_ext, tlvRoot, 0x01); // 0x01 - dummy tag
|
||||
if (!ddol_data_tlv){
|
||||
PrintAndLogEx(ERR, "Can't create DDOL TLV.");
|
||||
|
@ -617,6 +623,8 @@ int CmdEMVInternalAuthenticate(const char *cmd) {
|
|||
|
||||
if (ddol_data_tlv != &data_tlv)
|
||||
free(ddol_data_tlv);
|
||||
|
||||
tlvdb_free(tmp_ext);
|
||||
tlvdb_free(tlvRoot);
|
||||
|
||||
if (sw)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue