summaryrefslogtreecommitdiff
path: root/sshkey.c
diff options
context:
space:
mode:
Diffstat (limited to 'sshkey.c')
-rw-r--r--sshkey.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/sshkey.c b/sshkey.c
index 96a4d9090..87b093e91 100644
--- a/sshkey.c
+++ b/sshkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshkey.c,v 1.30 2015/12/11 02:31:47 mmcc Exp $ */ 1/* $OpenBSD: sshkey.c,v 1.31 2015/12/11 04:21:12 mmcc Exp $ */
2/* 2/*
3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
4 * Copyright (c) 2008 Alexander von Gernler. All rights reserved. 4 * Copyright (c) 2008 Alexander von Gernler. All rights reserved.
@@ -420,12 +420,9 @@ cert_free(struct sshkey_cert *cert)
420 420
421 if (cert == NULL) 421 if (cert == NULL)
422 return; 422 return;
423 if (cert->certblob != NULL) 423 sshbuf_free(cert->certblob);
424 sshbuf_free(cert->certblob); 424 sshbuf_free(cert->critical);
425 if (cert->critical != NULL) 425 sshbuf_free(cert->extensions);
426 sshbuf_free(cert->critical);
427 if (cert->extensions != NULL)
428 sshbuf_free(cert->extensions);
429 free(cert->key_id); 426 free(cert->key_id);
430 for (i = 0; i < cert->nprincipals; i++) 427 for (i = 0; i < cert->nprincipals; i++)
431 free(cert->principals[i]); 428 free(cert->principals[i]);
@@ -2472,8 +2469,7 @@ sshkey_certify(struct sshkey *k, struct sshkey *ca)
2472 sshbuf_reset(cert); 2469 sshbuf_reset(cert);
2473 free(sig_blob); 2470 free(sig_blob);
2474 free(ca_blob); 2471 free(ca_blob);
2475 if (principals != NULL) 2472 sshbuf_free(principals);
2476 sshbuf_free(principals);
2477 return ret; 2473 return ret;
2478} 2474}
2479 2475
@@ -3487,10 +3483,8 @@ sshkey_private_rsa1_to_blob(struct sshkey *key, struct sshbuf *blob,
3487 out: 3483 out:
3488 explicit_bzero(&ciphercontext, sizeof(ciphercontext)); 3484 explicit_bzero(&ciphercontext, sizeof(ciphercontext));
3489 explicit_bzero(buf, sizeof(buf)); 3485 explicit_bzero(buf, sizeof(buf));
3490 if (buffer != NULL) 3486 sshbuf_free(buffer);
3491 sshbuf_free(buffer); 3487 sshbuf_free(encrypted);
3492 if (encrypted != NULL)
3493 sshbuf_free(encrypted);
3494 3488
3495 return r; 3489 return r;
3496} 3490}
@@ -3644,8 +3638,7 @@ sshkey_parse_public_rsa1_fileblob(struct sshbuf *blob,
3644 pub = NULL; 3638 pub = NULL;
3645 3639
3646 out: 3640 out:
3647 if (copy != NULL) 3641 sshbuf_free(copy);
3648 sshbuf_free(copy);
3649 sshkey_free(pub); 3642 sshkey_free(pub);
3650 return r; 3643 return r;
3651} 3644}
@@ -3760,10 +3753,8 @@ sshkey_parse_private_rsa1(struct sshbuf *blob, const char *passphrase,
3760 explicit_bzero(&ciphercontext, sizeof(ciphercontext)); 3753 explicit_bzero(&ciphercontext, sizeof(ciphercontext));
3761 free(comment); 3754 free(comment);
3762 sshkey_free(prv); 3755 sshkey_free(prv);
3763 if (copy != NULL) 3756 sshbuf_free(copy);
3764 sshbuf_free(copy); 3757 sshbuf_free(decrypted);
3765 if (decrypted != NULL)
3766 sshbuf_free(decrypted);
3767 return r; 3758 return r;
3768} 3759}
3769#endif /* WITH_SSH1 */ 3760#endif /* WITH_SSH1 */