Skip to content

Commit 00cc9f0

Browse files
committed
Merge branch 'kmc'
2 parents d00dfbc + 8e36142 commit 00cc9f0

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/src_cryptography/src_libgcrypt/cryptography_interface_libgcrypt.template.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ static int32_t cryptography_validate_authentication(uint8_t* data_out, size_t le
804804
printf("%02X", tmac[i]);
805805
}
806806
printf("\n");
807-
free(tmac);
807+
if (!tmac) free(tmac);
808808

809809
printf("Received MAC:\n\t");
810810
for (uint32_t i = 0; i < mac_size; i ++){

src/src_main/crypto_tc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ int32_t Crypto_TC_ApplySecurity_Cam(const uint8_t* p_in_frame, const uint16_t in
662662
}
663663
if (status != CRYPTO_LIB_SUCCESS)
664664
{
665-
free(aad);
665+
if (!aad) free (aad);
666666
return status; // Cryptography IF call failed, return.
667667
}
668668
}
@@ -752,7 +752,7 @@ int32_t Crypto_TC_ApplySecurity_Cam(const uint8_t* p_in_frame, const uint16_t in
752752
#ifdef DEBUG
753753
printf(KYEL "----- Crypto_TC_ApplySecurity END -----\n" RESET);
754754
#endif
755-
free(aad);
755+
if (!aad) free (aad);
756756
return status;
757757
}
758758

@@ -1148,7 +1148,7 @@ int32_t Crypto_TC_ProcessSecurity_Cam(uint8_t* ingest, int *len_ingest, TC_t* tc
11481148

11491149
if (status != CRYPTO_LIB_SUCCESS)
11501150
{
1151-
free(aad);
1151+
if (!aad) free (aad);
11521152
return status; // Cryptography IF call failed, return.
11531153
}
11541154

@@ -1159,15 +1159,15 @@ int32_t Crypto_TC_ProcessSecurity_Cam(uint8_t* ingest, int *len_ingest, TC_t* tc
11591159

11601160
if(status != CRYPTO_LIB_SUCCESS)
11611161
{
1162-
free(aad);
1162+
if (!aad) free (aad);
11631163
return status;
11641164
}
11651165

11661166
// Only save the SA (IV/ARSN) if checking the anti-replay counter; Otherwise we don't update.
11671167
status = sadb_routine->sadb_save_sa(sa_ptr);
11681168
if(status != CRYPTO_LIB_SUCCESS)
11691169
{
1170-
free(aad);
1170+
if (!aad) free (aad);
11711171
return status;
11721172
}
11731173
}
@@ -1190,7 +1190,7 @@ int32_t Crypto_TC_ProcessSecurity_Cam(uint8_t* ingest, int *len_ingest, TC_t* tc
11901190
{
11911191
status = Crypto_Process_Extended_Procedure_Pdu(tc_sdls_processed_frame, ingest);
11921192
}
1193-
free(aad);
1193+
if (!aad) free (aad);
11941194
return status;
11951195
}
11961196

util/src_util/standalone.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ void* crypto_standalone_tc_apply(void* sock)
341341
memset(tc_apply_in, 0x00, sizeof(tc_apply_in));
342342
tc_in_len = 0;
343343
tc_out_len = 0;
344-
free(tc_out_ptr);
344+
if (!tc_out_ptr) free(tc_out_ptr);
345345
#ifdef CRYPTO_STANDALONE_TC_APPLY_DEBUG
346346
printf("\n");
347347
#endif

0 commit comments

Comments
 (0)