@@ -977,6 +977,10 @@ int32_t Crypto_AOS_ProcessSecurity(uint8_t *p_ingest, uint16_t len_ingest, AOS_t
977977 if (status != CRYPTO_LIB_SUCCESS )
978978 {
979979 mc_if -> mc_log (status );
980+ if (crypto_config .sa_type == SA_TYPE_MARIADB )
981+ {
982+ free (sa_ptr );
983+ }
980984 return status ;
981985 }
982986
@@ -1010,6 +1014,10 @@ int32_t Crypto_AOS_ProcessSecurity(uint8_t *p_ingest, uint16_t len_ingest, AOS_t
10101014#endif
10111015 status = CRYPTO_LIB_ERROR ;
10121016 mc_if -> mc_log (status );
1017+ if (crypto_config .sa_type == SA_TYPE_MARIADB )
1018+ {
1019+ free (sa_ptr );
1020+ }
10131021 return status ;
10141022 }
10151023
@@ -1035,6 +1043,10 @@ int32_t Crypto_AOS_ProcessSecurity(uint8_t *p_ingest, uint16_t len_ingest, AOS_t
10351043 {
10361044 status = CRYPTO_LIB_ERR_NO_ECS_SET_FOR_ENCRYPTION_MODE ;
10371045 mc_if -> mc_log (status );
1046+ if (crypto_config .sa_type == SA_TYPE_MARIADB )
1047+ {
1048+ free (sa_ptr );
1049+ }
10381050 return status ;
10391051 }
10401052
@@ -1060,6 +1072,10 @@ int32_t Crypto_AOS_ProcessSecurity(uint8_t *p_ingest, uint16_t len_ingest, AOS_t
10601072 {
10611073 status = CRYPTO_LIB_ERR_AOS_FL_LT_MAX_FRAME_SIZE ;
10621074 mc_if -> mc_log (status );
1075+ if (crypto_config .sa_type == SA_TYPE_MARIADB )
1076+ {
1077+ free (sa_ptr );
1078+ }
10631079 return status ;
10641080 }
10651081
@@ -1084,6 +1100,10 @@ int32_t Crypto_AOS_ProcessSecurity(uint8_t *p_ingest, uint16_t len_ingest, AOS_t
10841100#endif
10851101 status = CRYPTO_LIB_ERR_INVALID_FECF ;
10861102 mc_if -> mc_log (status );
1103+ if (crypto_config .sa_type == SA_TYPE_MARIADB )
1104+ {
1105+ free (sa_ptr );
1106+ }
10871107 return status ;
10881108 }
10891109 // Valid FECF, zero out the field
@@ -1105,6 +1125,10 @@ int32_t Crypto_AOS_ProcessSecurity(uint8_t *p_ingest, uint16_t len_ingest, AOS_t
11051125#endif
11061126 status = CRYPTO_LIB_ERR_TC_ENUM_USED_FOR_AOS_CONFIG ;
11071127 mc_if -> mc_log (status );
1128+ if (crypto_config .sa_type == SA_TYPE_MARIADB )
1129+ {
1130+ free (sa_ptr );
1131+ }
11081132 return status ;
11091133 }
11101134
@@ -1117,6 +1141,10 @@ int32_t Crypto_AOS_ProcessSecurity(uint8_t *p_ingest, uint16_t len_ingest, AOS_t
11171141#endif
11181142 status = CRYPTO_LIB_ERROR ;
11191143 mc_if -> mc_log (status );
1144+ if (crypto_config .sa_type == SA_TYPE_MARIADB )
1145+ {
1146+ free (sa_ptr );
1147+ }
11201148 return status ;
11211149 }
11221150
@@ -1226,13 +1254,21 @@ int32_t Crypto_AOS_ProcessSecurity(uint8_t *p_ingest, uint16_t len_ingest, AOS_t
12261254 status = CRYPTO_LIB_ERR_KEY_ID_ERROR ;
12271255 mc_if -> mc_log (status );
12281256 free (p_new_dec_frame );
1257+ if (crypto_config .sa_type == SA_TYPE_MARIADB )
1258+ {
1259+ free (sa_ptr );
1260+ }
12291261 return status ;
12301262 }
12311263 if (ekp -> key_state != KEY_ACTIVE )
12321264 {
12331265 status = CRYPTO_LIB_ERR_KEY_STATE_INVALID ;
12341266 mc_if -> mc_log (status );
12351267 free (p_new_dec_frame );
1268+ if (crypto_config .sa_type == SA_TYPE_MARIADB )
1269+ {
1270+ free (sa_ptr );
1271+ }
12361272 return status ;
12371273 }
12381274 }
@@ -1247,13 +1283,21 @@ int32_t Crypto_AOS_ProcessSecurity(uint8_t *p_ingest, uint16_t len_ingest, AOS_t
12471283 status = CRYPTO_LIB_ERR_KEY_ID_ERROR ;
12481284 mc_if -> mc_log (status );
12491285 free (p_new_dec_frame );
1286+ if (crypto_config .sa_type == SA_TYPE_MARIADB )
1287+ {
1288+ free (sa_ptr );
1289+ }
12501290 return status ;
12511291 }
12521292 if (akp -> key_state != KEY_ACTIVE )
12531293 {
12541294 status = CRYPTO_LIB_ERR_KEY_STATE_INVALID ;
12551295 mc_if -> mc_log (status );
12561296 free (p_new_dec_frame );
1297+ if (crypto_config .sa_type == SA_TYPE_MARIADB )
1298+ {
1299+ free (sa_ptr );
1300+ }
12571301 return status ;
12581302 }
12591303 }
@@ -1290,6 +1334,10 @@ int32_t Crypto_AOS_ProcessSecurity(uint8_t *p_ingest, uint16_t len_ingest, AOS_t
12901334 aad_len );
12911335#endif
12921336 mc_if -> mc_log (status );
1337+ if (crypto_config .sa_type == SA_TYPE_MARIADB )
1338+ {
1339+ free (sa_ptr );
1340+ }
12931341 return status ;
12941342 }
12951343
@@ -1313,6 +1361,10 @@ int32_t Crypto_AOS_ProcessSecurity(uint8_t *p_ingest, uint16_t len_ingest, AOS_t
13131361 printf (KRED "Error: SA Not Operational \n" RESET );
13141362#endif
13151363 free (p_new_dec_frame ); // Add cleanup
1364+ if (crypto_config .sa_type == SA_TYPE_MARIADB )
1365+ {
1366+ free (sa_ptr );
1367+ }
13161368 return CRYPTO_LIB_ERR_SA_NOT_OPERATIONAL ;
13171369 }
13181370
@@ -1389,6 +1441,10 @@ int32_t Crypto_AOS_ProcessSecurity(uint8_t *p_ingest, uint16_t len_ingest, AOS_t
13891441 free (p_new_dec_frame ); // Add cleanup
13901442 status = CRYPTO_LIB_ERR_KEY_LENGTH_ERROR ;
13911443 mc_if -> mc_log (status );
1444+ if (crypto_config .sa_type == SA_TYPE_MARIADB )
1445+ {
1446+ free (sa_ptr );
1447+ }
13921448 return status ;
13931449 }
13941450
@@ -1522,6 +1578,10 @@ int32_t Crypto_AOS_ProcessSecurity(uint8_t *p_ingest, uint16_t len_ingest, AOS_t
15221578 (uint16_t )(p_new_dec_frame [byte_idx ] << 8 ) | p_new_dec_frame [byte_idx + 1 ];
15231579 }
15241580 free (p_new_dec_frame );
1581+ if (crypto_config .sa_type == SA_TYPE_MARIADB )
1582+ {
1583+ free (sa_ptr );
1584+ }
15251585
15261586#ifdef DEBUG
15271587 printf (KYEL "----- Crypto_AOS_ProcessSecurity END -----\n" RESET );
0 commit comments