Free psa crypto at the end of programs when initialized

Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
diff --git a/programs/x509/load_roots.c b/programs/x509/load_roots.c
index 87187e6..bca6e88 100644
--- a/programs/x509/load_roots.c
+++ b/programs/x509/load_roots.c
@@ -127,11 +127,6 @@
     struct mbedtls_timing_hr_time timer;
     unsigned long ms;
 
-    if (argc <= 1) {
-        mbedtls_printf(USAGE);
-        goto exit;
-    }
-
 #if defined(MBEDTLS_USE_PSA_CRYPTO)
     psa_status_t status = psa_crypto_init();
     if (status != PSA_SUCCESS) {
@@ -141,6 +136,11 @@
     }
 #endif /* MBEDTLS_USE_PSA_CRYPTO */
 
+    if (argc <= 1) {
+        mbedtls_printf(USAGE);
+        goto exit;
+    }
+
     opt.filenames = NULL;
     opt.iterations = DFL_ITERATIONS;
     opt.prime_cache = DFL_PRIME_CACHE;
@@ -200,6 +200,7 @@
     exit_code = MBEDTLS_EXIT_SUCCESS;
 
 exit:
+    mbedtls_psa_crypto_free();
     mbedtls_exit(exit_code);
 }
 #endif /* necessary configuration */