From afa86809087909a8ba2f9356588bf90cc923529c Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 29 Mar 2017 11:57:40 +0200 Subject: 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 --- g10/kbnode.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'g10/kbnode.c') diff --git a/g10/kbnode.c b/g10/kbnode.c index b8c31b7a3..c2aaacd76 100644 --- a/g10/kbnode.c +++ b/g10/kbnode.c @@ -117,8 +117,8 @@ release_kbnode( KBNODE n ) while( n ) { n2 = n->next; if( !is_cloned_kbnode(n) ) { - free_packet( n->pkt ); - xfree( n->pkt ); + free_packet (n->pkt, NULL); + xfree( n->pkt ); } free_node( n ); n = n2; @@ -288,7 +288,7 @@ commit_kbnode( KBNODE *root ) else nl->next = n->next; if( !is_cloned_kbnode(n) ) { - free_packet( n->pkt ); + free_packet (n->pkt, NULL); xfree( n->pkt ); } free_node( n ); @@ -312,7 +312,7 @@ remove_kbnode( KBNODE *root, KBNODE node ) else nl->next = n->next; if( !is_cloned_kbnode(n) ) { - free_packet( n->pkt ); + free_packet (n->pkt, NULL); xfree( n->pkt ); } free_node( n ); -- cgit v1.2.3