Make the handling of output and input formats consistent
[openssl.git] / apps / sess_id.c
index cfecd86a50030f3a3377944297d8f273ffa195a0..e743791d23f5eb8eb438707031648bfbe1adc75a 100644 (file)
@@ -160,10 +160,7 @@ int sess_id_main(int argc, char **argv)
     }
 
     if (!noout || text) {
-        const char* modeflag = "w";
-        if (outformat == FORMAT_ASN1 || outformat == FORMAT_NSS)
-            modeflag = "wb";
-        out = bio_open_default(outfile, modeflag);
+        out = bio_open_default(outfile, WB(outformat));
         if (out == NULL)
             goto end;
     }
@@ -211,8 +208,7 @@ int sess_id_main(int argc, char **argv)
     ret = 0;
  end:
     BIO_free_all(out);
-    if (x != NULL)
-        SSL_SESSION_free(x);
+    SSL_SESSION_free(x);
     return (ret);
 }