Add a FuzzerClean() function
authorKurt Roeckx <kurt@roeckx.be>
Sat, 19 Nov 2016 16:13:10 +0000 (17:13 +0100)
committerKurt Roeckx <kurt@roeckx.be>
Fri, 2 Dec 2016 23:14:14 +0000 (00:14 +0100)
This allows to free everything we allocated, so we can detect memory
leaks.

Reviewed-by: Rich Salz <rsalz@openssl.org>
GH: #2023

13 files changed:
fuzz/asn1.c
fuzz/asn1parse.c
fuzz/bignum.c
fuzz/bndiv.c
fuzz/cms.c
fuzz/conf.c
fuzz/crl.c
fuzz/ct.c
fuzz/driver.c
fuzz/fuzzer.h
fuzz/server.c
fuzz/test-corpus.c
fuzz/x509.c

index 0644ed79e1328dc0ba20ed68fa84c721c5961844..f7b5571d4f7d2d3e21352232b2dc32332c38fe20 100644 (file)
@@ -222,3 +222,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
 
     return 0;
 }
 
     return 0;
 }
+
+void FuzzerCleanup(void)
+{
+}
index 2fba1c44b6a4ccb6a0d8eb8a5a7935210aa2739e..edb4d023030273f199208a4645a4c832b38e0a11 100644 (file)
@@ -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)ASN1_parse_dump(bio_out, buf, len, 0, 0);
     return 0;
 }
+
+void FuzzerCleanup(void)
+{
+}
index 9e110f65ef4d98265cb736037cd0fe1b6d6795bb..d6e8637a98dd4c6ced13d78509b30ef563a34729 100644 (file)
@@ -94,3 +94,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
 
     return 0;
 }
 
     return 0;
 }
+
+void FuzzerCleanup(void)
+{
+}
index 931987860797091079ca678fd7dd712d6051b234..eb17f29cab57aa12719581fdb26b503cdd9aff69 100644 (file)
@@ -107,3 +107,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
 
     return 0;
 }
 
     return 0;
 }
+
+void FuzzerCleanup(void)
+{
+}
index 71d8b6953c998c6d339b8d46c0ee5ecf3db13a91..c4477efa8fd00f1e92d717ddf3b8fcaa1652084c 100644 (file)
@@ -36,3 +36,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
     BIO_free(in);
     return 0;
 }
     BIO_free(in);
     return 0;
 }
+
+void FuzzerCleanup(void)
+{
+}
index 49edb3eaa6937347ca99e70bb134aeaca7cc3763..27429c570f1285855fb571010ba72e352d088d7f 100644 (file)
@@ -38,3 +38,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
 
     return 0;
 }
 
     return 0;
 }
+
+void FuzzerCleanup(void)
+{
+}
index 51d184363ad2ecf1a22eda16ff56f20ea4fec2db..decf19e9d3e5912d565e58979ea4c63944cc87b3 100644 (file)
@@ -35,3 +35,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
     }
     return 0;
 }
     }
     return 0;
 }
+
+void FuzzerCleanup(void)
+{
+}
index 636b19510996ff53dba115a15eeb10e9797a1917..47b0fc3f78af3809740803f663515c8edc6644ea 100644 (file)
--- a/fuzz/ct.c
+++ b/fuzz/ct.c
@@ -40,3 +40,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
     }
     return 0;
 }
     }
     return 0;
 }
+
+void FuzzerCleanup(void)
+{
+}
index d4b11cd6a477c91be8c5ed096cbeb7fbac6115ad..21bbb255afe51066f16af31dff214dee347bba28 100644 (file)
@@ -40,6 +40,8 @@ int main(int argc, char** argv)
         FuzzerTestOneInput(buf, size);
         free(buf);
     }
         FuzzerTestOneInput(buf, size);
         free(buf);
     }
+
+    FuzzerCleanup();
     return 0;
 }
 
     return 0;
 }
 
index 04d605d79a2fba34104b7f8324f87f0fdb125108..5f9efa4bf6b96b128f031d31dcfd47c658464a52 100644 (file)
@@ -10,3 +10,4 @@
 
 int FuzzerTestOneInput(const uint8_t *buf, size_t len);
 int FuzzerInitialize(int *argc, char ***argv);
 
 int FuzzerTestOneInput(const uint8_t *buf, size_t len);
 int FuzzerInitialize(int *argc, char ***argv);
+void FuzzerCleanup(void);
index 26ef4da1e64e4609708b4852d4915f12d10289f4..b8a3ac44e382a11b2d5fe88b1b1caaaa1087f5af 100644 (file)
@@ -250,3 +250,8 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
     SSL_free(server);
     return 0;
 }
     SSL_free(server);
     return 0;
 }
+
+void FuzzerCleanup(void)
+{
+    SSL_CTX_free(ctx);
+}
index c553697d6c78aac43e0ae75af347aa1950c85505..9cef01f86d9afaa3591b0bb093613142a25013c5 100644 (file)
@@ -42,5 +42,8 @@ int main(int argc, char **argv) {
         free(buf);
         fclose(f);
     }
         free(buf);
         fclose(f);
     }
+
+    FuzzerCleanup();
+
     return 0;
 }
     return 0;
 }
index 4c5b73258d53f604ea817c3d930e6f676636ad1f..78fef6c3ff00434626d6aa2dc2ab653e365e5c86 100644 (file)
@@ -36,3 +36,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
     }
     return 0;
 }
     }
     return 0;
 }
+
+void FuzzerCleanup(void)
+{
+}