summaryrefslogtreecommitdiffstats
path: root/g10/keydb.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2017-03-29 11:57:40 +0200
committerWerner Koch <wk@gnupg.org>2017-03-29 12:08:31 +0200
commitafa86809087909a8ba2f9356588bf90cc923529c (patch)
treeff0941a7831c23a47f9dafa522b375b7cc00daa4 /g10/keydb.c
parentindent: Re-indent function free-packet. (diff)
downloadgnupg2-afa86809087909a8ba2f9356588bf90cc923529c.tar.xz
gnupg2-afa86809087909a8ba2f9356588bf90cc923529c.zip
gpg: Extend free_packet to handle a packet parser context.
* g10/packet.h (struct parse_packet_ctx_s): Add fields LAST_PKT and FREE_LAST_PKT. (init_parse_packet): Clear them. (deinit_parse_packet): New macro. Change all users if init_parse_packet to also call this macro. * g10/free-packet.c (free_packet): Add arg PARSECTX and handle shallow packet copies in the context. Change all callers. * g10/parse-packet.c (parse): Store certain packets in the parse context. -- Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10/keydb.c')
-rw-r--r--g10/keydb.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/g10/keydb.c b/g10/keydb.c
index c0bc9f521..1bbda35c7 100644
--- a/g10/keydb.c
+++ b/g10/keydb.c
@@ -1180,7 +1180,7 @@ parse_keyblock_image (iobuf_t iobuf, int pk_no, int uid_no,
{
if (gpg_err_code (err) == GPG_ERR_UNKNOWN_PACKET)
{
- free_packet (pkt);
+ free_packet (pkt, &parsectx);
init_packet (pkt);
continue;
}
@@ -1209,7 +1209,7 @@ parse_keyblock_image (iobuf_t iobuf, int pk_no, int uid_no,
the other GPG specific packets don't make sense either. */
log_error ("skipped packet of type %d in keybox\n",
(int)pkt->pkttype);
- free_packet(pkt);
+ free_packet(pkt, &parsectx);
init_packet(pkt);
continue;
}
@@ -1311,7 +1311,8 @@ parse_keyblock_image (iobuf_t iobuf, int pk_no, int uid_no,
release_kbnode (keyblock);
else
*r_keyblock = keyblock;
- free_packet (pkt);
+ free_packet (pkt, &parsectx);
+ deinit_parse_packet (&parsectx);
xfree (pkt);
return err;
}