summaryrefslogtreecommitdiff
path: root/devel
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-04-28 23:12:19 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-04-28 23:12:19 +0200
commit553906ba264c591ca947983fc2f3c083fb818eb4 (patch)
tree2736383ae54f039d5bc9cdc4b5c6a9c9e849b0a9 /devel
parent80140f20a814bfe8114ead3915a19ceca7144201 (diff)
downloadgnutls-553906ba264c591ca947983fc2f3c083fb818eb4.tar.gz
fuzz: fix leaks in PKCS#12 fuzzer
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'devel')
-rw-r--r--devel/fuzz/gnutls_pkcs12_key_parser_fuzzer.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/devel/fuzz/gnutls_pkcs12_key_parser_fuzzer.cc b/devel/fuzz/gnutls_pkcs12_key_parser_fuzzer.cc
index 1c3c15cce9..84f1ddb153 100644
--- a/devel/fuzz/gnutls_pkcs12_key_parser_fuzzer.cc
+++ b/devel/fuzz/gnutls_pkcs12_key_parser_fuzzer.cc
@@ -53,10 +53,16 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
gnutls_x509_privkey_deinit(key);
if (crl)
gnutls_x509_crl_deinit(crl);
- for (i=0;i<extras_len;i++)
- gnutls_x509_crt_deinit(extras[i]);
- for (i=0;i<chain_len;i++)
- gnutls_x509_crt_deinit(chain[i]);
+ if (extras_len > 0) {
+ for (i=0;i<extras_len;i++)
+ gnutls_x509_crt_deinit(extras[i]);
+ gnutls_free(extras);
+ }
+ if (chain_len > 0) {
+ for (i=0;i<chain_len;i++)
+ gnutls_x509_crt_deinit(chain[i]);
+ gnutls_free(chain);
+ }
}
cleanup: