1
0
Fork 0
mirror of https://github.com/deltachat/deltachat-core.git synced 2025-10-06 03:50:08 +02:00

Merge pull request #334 from deltachat/null-checks

check for some NULL-pointers in netpgp
This commit is contained in:
holger krekel 2018-09-30 09:18:29 +02:00 committed by GitHub
commit c92b0b5c4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View file

@ -122,6 +122,10 @@ pgp_key_free(pgp_key_t *key)
{ {
unsigned n; unsigned n;
if (key==NULL) {
return;
}
if (key->type == PGP_PTAG_CT_PUBLIC_KEY) { if (key->type == PGP_PTAG_CT_PUBLIC_KEY) {
pgp_pubkey_free(&key->key.pubkey); pgp_pubkey_free(&key->key.pubkey);
} else { } else {

View file

@ -968,6 +968,10 @@ cmd_get_passphrase_free(pgp_seckey_passphrase_t *skp)
static void static void
free_BN(BIGNUM **pp) free_BN(BIGNUM **pp)
{ {
if (pp==NULL || *pp==NULL) {
return;
}
BN_free(*pp); BN_free(*pp);
*pp = NULL; *pp = NULL;
} }
@ -1272,6 +1276,10 @@ pgp_pk_sesskey_free(pgp_pk_sesskey_t *sk)
void void
pgp_pubkey_free(pgp_pubkey_t *p) pgp_pubkey_free(pgp_pubkey_t *p)
{ {
if (p==NULL) {
return;
}
switch (p->alg) { switch (p->alg) {
case PGP_PKA_RSA: case PGP_PKA_RSA:
case PGP_PKA_RSA_ENCRYPT_ONLY: case PGP_PKA_RSA_ENCRYPT_ONLY: