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
This commit is contained in:
Kurt Roeckx 2016-11-19 17:13:10 +01:00
parent baae2cbc92
commit ad4da7fbc0
13 changed files with 47 additions and 0 deletions

View File

@ -222,3 +222,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
return 0;
}
void FuzzerCleanup(void)
{
}

View 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 FuzzerCleanup(void)
{
}

View File

@ -94,3 +94,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
return 0;
}
void FuzzerCleanup(void)
{
}

View File

@ -107,3 +107,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
return 0;
}
void FuzzerCleanup(void)
{
}

View File

@ -36,3 +36,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
BIO_free(in);
return 0;
}
void FuzzerCleanup(void)
{
}

View File

@ -38,3 +38,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
return 0;
}
void FuzzerCleanup(void)
{
}

View File

@ -35,3 +35,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
}
return 0;
}
void FuzzerCleanup(void)
{
}

View File

@ -40,3 +40,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
}
return 0;
}
void FuzzerCleanup(void)
{
}

View File

@ -40,6 +40,8 @@ int main(int argc, char** argv)
FuzzerTestOneInput(buf, size);
free(buf);
}
FuzzerCleanup();
return 0;
}

View File

@ -10,3 +10,4 @@
int FuzzerTestOneInput(const uint8_t *buf, size_t len);
int FuzzerInitialize(int *argc, char ***argv);
void FuzzerCleanup(void);

View File

@ -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);
}

View File

@ -42,5 +42,8 @@ int main(int argc, char **argv) {
free(buf);
fclose(f);
}
FuzzerCleanup();
return 0;
}

View File

@ -36,3 +36,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
}
return 0;
}
void FuzzerCleanup(void)
{
}