From f41991480aaa79db55e75363dfbb4f278cb8ea21 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Wed, 18 Sep 2019 16:40:58 +0900 Subject: estream: Care about erroneous case for stream close. * src/estream.c (do_list_remove): Only access ITEM->NEXT when it's not null. GnuPG-bug-id: 4698 Signed-off-by: NIIBE Yutaka --- src/estream.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/estream.c b/src/estream.c index a23d817..6b531fb 100644 --- a/src/estream.c +++ b/src/estream.c @@ -461,19 +461,14 @@ do_list_remove (estream_t stream, int with_locked_list) else item_prev = item; - if (item_prev) + if (item) { - item_prev->next = item->next; + if (item_prev) + item_prev->next = item->next; + else + estream_list = item->next; mem_free (item); } - else - { - if (item) - { - estream_list = item->next; - mem_free (item); - } - } if (!with_locked_list) unlock_list (); -- cgit v1.2.3