bignum fuzzer: move new and free calls to the init and cleanup function.
[openssl.git] / fuzz / asn1parse.c
index 63104fb7d09d41dd8caae5dbb5c1e4cc40aee07d..3e11d350c1b68d5f1600cc7a100b742a36c779df 100644 (file)
 #include <openssl/x509v3.h>
 #include "fuzzer.h"
 
-int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) {
-    static BIO *bio_out;
+static BIO *bio_out;
 
-    if (bio_out == NULL)
-        bio_out = BIO_new_file("/dev/null", "w");
+int FuzzerInitialize(int *argc, char ***argv)
+{
+    bio_out = BIO_new_file("/dev/null", "w");
+    return 1;
+}
 
+int FuzzerTestOneInput(const uint8_t *buf, size_t len)
+{
     (void)ASN1_parse_dump(bio_out, buf, len, 0, 0);
     return 0;
 }
+
+void FuzzerCleanup(void)
+{
+    BIO_free(bio_out);
+}