aboutsummaryrefslogtreecommitdiffstats
path: root/fuzz
diff options
context:
space:
mode:
authorKurt Roeckx <kurt@roeckx.be>2016-11-19 17:13:10 +0100
committerKurt Roeckx <kurt@roeckx.be>2016-12-03 00:14:14 +0100
commitad4da7fbc0779fb1730c9862221e19583de69f4f (patch)
tree2d28fc3b7aa07ded6ca7841daeddb91216f43df6 /fuzz
parentbaae2cbc92accf4fa53a7b8faaf3df1153c943f5 (diff)
downloadopenssl-ad4da7fbc0779fb1730c9862221e19583de69f4f.tar.gz
Add a FuzzerClean() function
This allows to free everything we allocated, so we can detect memory leaks. Reviewed-by: Rich Salz <rsalz@openssl.org> GH: #2023
Diffstat (limited to 'fuzz')
-rw-r--r--fuzz/asn1.c4
-rw-r--r--fuzz/asn1parse.c4
-rw-r--r--fuzz/bignum.c4
-rw-r--r--fuzz/bndiv.c4
-rw-r--r--fuzz/cms.c4
-rw-r--r--fuzz/conf.c4
-rw-r--r--fuzz/crl.c4
-rw-r--r--fuzz/ct.c4
-rw-r--r--fuzz/driver.c2
-rw-r--r--fuzz/fuzzer.h1
-rw-r--r--fuzz/server.c5
-rw-r--r--fuzz/test-corpus.c3
-rw-r--r--fuzz/x509.c4
13 files changed, 47 insertions, 0 deletions
diff --git a/fuzz/asn1.c b/fuzz/asn1.c
index 0644ed79e1..f7b5571d4f 100644
--- a/fuzz/asn1.c
+++ b/fuzz/asn1.c
@@ -222,3 +222,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
return 0;
}
+
+void FuzzerCleanup(void)
+{
+}
diff --git a/fuzz/asn1parse.c b/fuzz/asn1parse.c
index 2fba1c44b6..edb4d02303 100644
--- a/fuzz/asn1parse.c
+++ b/fuzz/asn1parse.c
@@ -33,3 +33,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
(void)ASN1_parse_dump(bio_out, buf, len, 0, 0);
return 0;
}
+
+void FuzzerCleanup(void)
+{
+}
diff --git a/fuzz/bignum.c b/fuzz/bignum.c
index 9e110f65ef..d6e8637a98 100644
--- a/fuzz/bignum.c
+++ b/fuzz/bignum.c
@@ -94,3 +94,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
return 0;
}
+
+void FuzzerCleanup(void)
+{
+}
diff --git a/fuzz/bndiv.c b/fuzz/bndiv.c
index 9319878607..eb17f29cab 100644
--- a/fuzz/bndiv.c
+++ b/fuzz/bndiv.c
@@ -107,3 +107,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
return 0;
}
+
+void FuzzerCleanup(void)
+{
+}
diff --git a/fuzz/cms.c b/fuzz/cms.c
index 71d8b6953c..c4477efa8f 100644
--- a/fuzz/cms.c
+++ b/fuzz/cms.c
@@ -36,3 +36,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
BIO_free(in);
return 0;
}
+
+void FuzzerCleanup(void)
+{
+}
diff --git a/fuzz/conf.c b/fuzz/conf.c
index 49edb3eaa6..27429c570f 100644
--- a/fuzz/conf.c
+++ b/fuzz/conf.c
@@ -38,3 +38,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
return 0;
}
+
+void FuzzerCleanup(void)
+{
+}
diff --git a/fuzz/crl.c b/fuzz/crl.c
index 51d184363a..decf19e9d3 100644
--- a/fuzz/crl.c
+++ b/fuzz/crl.c
@@ -35,3 +35,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
}
return 0;
}
+
+void FuzzerCleanup(void)
+{
+}
diff --git a/fuzz/ct.c b/fuzz/ct.c
index 636b195109..47b0fc3f78 100644
--- a/fuzz/ct.c
+++ b/fuzz/ct.c
@@ -40,3 +40,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
}
return 0;
}
+
+void FuzzerCleanup(void)
+{
+}
diff --git a/fuzz/driver.c b/fuzz/driver.c
index d4b11cd6a4..21bbb255af 100644
--- a/fuzz/driver.c
+++ b/fuzz/driver.c
@@ -40,6 +40,8 @@ int main(int argc, char** argv)
FuzzerTestOneInput(buf, size);
free(buf);
}
+
+ FuzzerCleanup();
return 0;
}
diff --git a/fuzz/fuzzer.h b/fuzz/fuzzer.h
index 04d605d79a..5f9efa4bf6 100644
--- a/fuzz/fuzzer.h
+++ b/fuzz/fuzzer.h
@@ -10,3 +10,4 @@
int FuzzerTestOneInput(const uint8_t *buf, size_t len);
int FuzzerInitialize(int *argc, char ***argv);
+void FuzzerCleanup(void);
diff --git a/fuzz/server.c b/fuzz/server.c
index 26ef4da1e6..b8a3ac44e3 100644
--- a/fuzz/server.c
+++ b/fuzz/server.c
@@ -250,3 +250,8 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
SSL_free(server);
return 0;
}
+
+void FuzzerCleanup(void)
+{
+ SSL_CTX_free(ctx);
+}
diff --git a/fuzz/test-corpus.c b/fuzz/test-corpus.c
index c553697d6c..9cef01f86d 100644
--- a/fuzz/test-corpus.c
+++ b/fuzz/test-corpus.c
@@ -42,5 +42,8 @@ int main(int argc, char **argv) {
free(buf);
fclose(f);
}
+
+ FuzzerCleanup();
+
return 0;
}
diff --git a/fuzz/x509.c b/fuzz/x509.c
index 4c5b73258d..78fef6c3ff 100644
--- a/fuzz/x509.c
+++ b/fuzz/x509.c
@@ -36,3 +36,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
}
return 0;
}
+
+void FuzzerCleanup(void)
+{
+}