Fix small UI issues
[openssl.git] / crypto / ui / ui_lib.c
index f4e01bcf38af537f949b6fcc2d57ffecc1d6db79..5b3eaff121a5150027eba325d0f27a84b9a25d1b 100644 (file)
@@ -37,9 +37,10 @@ UI *UI_new_method(const UI_METHOD *method)
     }
 
     if (method == NULL)
-        ret->meth = UI_get_default_method();
-    else
-        ret->meth = method;
+        method = UI_get_default_method();
+    if (method == NULL)
+        method = UI_null();
+    ret->meth = method;
 
     if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_UI, ret, &ret->ex_data)) {
         OPENSSL_free(ret);
@@ -514,6 +515,8 @@ int UI_process(UI *ui)
             }
         }
     }
+
+    state = NULL;
  err:
     if (ui->meth->ui_close_session != NULL
         && ui->meth->ui_close_session(ui) <= 0) {