diff --git a/src/pki/commands/pkcs7.c b/src/pki/commands/pkcs7.c index 8d3528fdc..074beeab5 100644 --- a/src/pki/commands/pkcs7.c +++ b/src/pki/commands/pkcs7.c @@ -235,8 +235,7 @@ static int decrypt(chunk_t chunk) container->destroy(container); write_to_stream(stdout, data); - free(data.ptr); - + chunk_clear(&data); return 0; } diff --git a/src/pki/commands/scep.c b/src/pki/commands/scep.c index f5cc93084..a1f0530a9 100644 --- a/src/pki/commands/scep.c +++ b/src/pki/commands/scep.c @@ -587,7 +587,7 @@ end: if (status == 0) { status = pki_cert_extract_cert(data, form) ? 0 : 1; - chunk_free(&data); + chunk_clear(&data); } err: