summaryrefslogtreecommitdiffstats
path: root/fuzz/asn1parse.c
diff options
context:
space:
mode:
authorKurt Roeckx <kurt@roeckx.be>2016-11-19 17:24:39 +0100
committerKurt Roeckx <kurt@roeckx.be>2016-12-03 00:14:14 +0100
commitda15cb7cd99be8dac3d28f78a0cf97437e9f5fac (patch)
treecea9514573412b5e3e365fefbde0d36a64170492 /fuzz/asn1parse.c
parentad4da7fbc0779fb1730c9862221e19583de69f4f (diff)
asn1parse: create the out bio during init, free it during cleanup
Reviewed-by: Rich Salz <rsalz@openssl.org> GH: #2023
Diffstat (limited to 'fuzz/asn1parse.c')
-rw-r--r--fuzz/asn1parse.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/fuzz/asn1parse.c b/fuzz/asn1parse.c
index edb4d02303..3e11d350c1 100644
--- a/fuzz/asn1parse.c
+++ b/fuzz/asn1parse.c
@@ -18,22 +18,21 @@
#include <openssl/x509v3.h>
#include "fuzzer.h"
+static BIO *bio_out;
+
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)
{
- static BIO *bio_out;
-
- if (bio_out == NULL)
- bio_out = BIO_new_file("/dev/null", "w");
-
(void)ASN1_parse_dump(bio_out, buf, len, 0, 0);
return 0;
}
void FuzzerCleanup(void)
{
+ BIO_free(bio_out);
}