@@ -636,48 +636,55 @@ int32_t crypto_free_config_structs(void)
636
636
{
637
637
int32_t status = CRYPTO_LIB_SUCCESS ;
638
638
639
- // free(crypto_config); //no strings in this struct, just free it.
640
- crypto_config .init_status = UNITIALIZED ;
641
-
642
- // Config structs with char* types that are malloc'd and must be freed individually.
643
- if (sa_mariadb_config != NULL )
644
- {
645
- free (sa_mariadb_config -> mysql_username );
646
- free (sa_mariadb_config -> mysql_password );
647
- free (sa_mariadb_config -> mysql_hostname );
648
- free (sa_mariadb_config -> mysql_database );
649
- free (sa_mariadb_config -> mysql_mtls_cert );
650
- free (sa_mariadb_config -> mysql_mtls_key );
651
- free (sa_mariadb_config -> mysql_mtls_ca );
652
- free (sa_mariadb_config -> mysql_mtls_capath );
653
- free (sa_mariadb_config -> mysql_mtls_client_key_password );
654
- free (sa_mariadb_config );
655
- sa_mariadb_config = NULL ;
656
- }
657
- if (cryptography_kmc_crypto_config != NULL )
639
+ if (crypto_config .init_status == UNITIALIZED )
658
640
{
659
- free (cryptography_kmc_crypto_config -> kmc_crypto_hostname );
660
- free (cryptography_kmc_crypto_config -> protocol );
661
- free (cryptography_kmc_crypto_config -> kmc_crypto_app_uri );
662
- free (cryptography_kmc_crypto_config -> mtls_client_cert_path );
663
- free (cryptography_kmc_crypto_config -> mtls_client_cert_type );
664
- free (cryptography_kmc_crypto_config -> mtls_client_key_path );
665
- free (cryptography_kmc_crypto_config -> mtls_client_key_pass );
666
- free (cryptography_kmc_crypto_config -> mtls_ca_bundle );
667
- free (cryptography_kmc_crypto_config -> mtls_ca_path );
668
- free (cryptography_kmc_crypto_config -> mtls_issuer_cert );
669
- free (cryptography_kmc_crypto_config );
670
- cryptography_kmc_crypto_config = NULL ;
641
+ status = CRYPTO_LIB_SUCCESS ;
671
642
}
672
- if ( cam_config != NULL )
643
+ else
673
644
{
674
- free (cam_config -> cookie_file_path );
675
- free (cam_config -> keytab_file_path );
676
- free (cam_config -> access_manager_uri );
677
- free (cam_config -> username );
678
- free (cam_config -> cam_home );
679
- free (cam_config );
680
- cam_config = NULL ;
645
+ // free(crypto_config); //no strings in this struct, just free it.
646
+ crypto_config .init_status = UNITIALIZED ;
647
+
648
+ // Config structs with char* types that are malloc'd and must be freed individually.
649
+ if (sa_mariadb_config != NULL )
650
+ {
651
+ free (sa_mariadb_config -> mysql_username );
652
+ free (sa_mariadb_config -> mysql_password );
653
+ free (sa_mariadb_config -> mysql_hostname );
654
+ free (sa_mariadb_config -> mysql_database );
655
+ free (sa_mariadb_config -> mysql_mtls_cert );
656
+ free (sa_mariadb_config -> mysql_mtls_key );
657
+ free (sa_mariadb_config -> mysql_mtls_ca );
658
+ free (sa_mariadb_config -> mysql_mtls_capath );
659
+ free (sa_mariadb_config -> mysql_mtls_client_key_password );
660
+ free (sa_mariadb_config );
661
+ sa_mariadb_config = NULL ;
662
+ }
663
+ if (cryptography_kmc_crypto_config != NULL )
664
+ {
665
+ free (cryptography_kmc_crypto_config -> kmc_crypto_hostname );
666
+ free (cryptography_kmc_crypto_config -> protocol );
667
+ free (cryptography_kmc_crypto_config -> kmc_crypto_app_uri );
668
+ free (cryptography_kmc_crypto_config -> mtls_client_cert_path );
669
+ free (cryptography_kmc_crypto_config -> mtls_client_cert_type );
670
+ free (cryptography_kmc_crypto_config -> mtls_client_key_path );
671
+ free (cryptography_kmc_crypto_config -> mtls_client_key_pass );
672
+ free (cryptography_kmc_crypto_config -> mtls_ca_bundle );
673
+ free (cryptography_kmc_crypto_config -> mtls_ca_path );
674
+ free (cryptography_kmc_crypto_config -> mtls_issuer_cert );
675
+ free (cryptography_kmc_crypto_config );
676
+ cryptography_kmc_crypto_config = NULL ;
677
+ }
678
+ if (cam_config != NULL )
679
+ {
680
+ free (cam_config -> cookie_file_path );
681
+ free (cam_config -> keytab_file_path );
682
+ free (cam_config -> access_manager_uri );
683
+ free (cam_config -> username );
684
+ free (cam_config -> cam_home );
685
+ free (cam_config );
686
+ cam_config = NULL ;
687
+ }
681
688
}
682
689
return status ;
683
690
}
0 commit comments