diff options
author | Werner Koch <wk@gnupg.org> | 2011-09-20 19:24:52 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2011-09-20 19:24:52 +0200 |
commit | 6cf8890dc1f551a1e87ed8b8e67a733e95b1bb6d (patch) | |
tree | a4485063c34975876ad80d0898af16379d095bc3 /g10/free-packet.c | |
parent | tests: avoid use of freed pointer (diff) | |
download | gnupg2-6cf8890dc1f551a1e87ed8b8e67a733e95b1bb6d.tar.xz gnupg2-6cf8890dc1f551a1e87ed8b8e67a733e95b1bb6d.zip |
Allow NULL for free_public_key.
Diffstat (limited to 'g10/free-packet.c')
-rw-r--r-- | g10/free-packet.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/g10/free-packet.c b/g10/free-packet.c index 267568478..596322127 100644 --- a/g10/free-packet.c +++ b/g10/free-packet.c @@ -120,11 +120,16 @@ release_public_key_parts (PKT_public_key *pk) } +/* Free an allocated public key structure including all parts. + Passing NULL is allowed. */ void free_public_key (PKT_public_key *pk) { - release_public_key_parts (pk); - xfree(pk); + if (pk) + { + release_public_key_parts (pk); + xfree(pk); + } } |