diff options
Diffstat (limited to 'demos/smime')
-rw-r--r-- | demos/smime/smver.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/demos/smime/smver.c b/demos/smime/smver.c index 601462a041..5d552b1808 100644 --- a/demos/smime/smver.c +++ b/demos/smime/smver.c @@ -27,16 +27,18 @@ int main(int argc, char **argv) /* Set up trusted CA certificate store */ st = X509_STORE_new(); + if (st == NULL) + goto err; /* Read in signer certificate and private key */ tbio = BIO_new_file("cacert.pem", "r"); - if (!tbio) + if (tbio == NULL) goto err; cacert = PEM_read_bio_X509(tbio, NULL, 0, NULL); - if (!cacert) + if (cacert == NULL) goto err; if (!X509_STORE_add_cert(st, cacert)) @@ -46,18 +48,18 @@ int main(int argc, char **argv) in = BIO_new_file("smout.txt", "r"); - if (!in) + if (in == NULL) goto err; /* Sign content */ p7 = SMIME_read_PKCS7(in, &cont); - if (!p7) + if (p7 == NULL) goto err; /* File to output verified content to */ out = BIO_new_file("smver.txt", "w"); - if (!out) + if (out == NULL) goto err; if (!PKCS7_verify(p7, NULL, st, cont, out, 0)) { @@ -74,6 +76,8 @@ int main(int argc, char **argv) fprintf(stderr, "Error Verifying Data\n"); ERR_print_errors_fp(stderr); } + + X509_STORE_free(st); PKCS7_free(p7); X509_free(cacert); BIO_free(in); |