summaryrefslogtreecommitdiff
path: root/src/estream.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2019-09-18 16:40:58 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2019-09-18 16:40:58 +0900
commitf41991480aaa79db55e75363dfbb4f278cb8ea21 (patch)
treef93368fa7c177020961d89b7de4516eaa7f3c593 /src/estream.c
parentc1e80f6e8e368c271bbf413d9eaea772ef2062d1 (diff)
downloadlibgpg-error-f41991480aaa79db55e75363dfbb4f278cb8ea21.tar.gz
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 <gniibe@fsij.org>
Diffstat (limited to 'src/estream.c')
-rw-r--r--src/estream.c15
1 files 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 ();