aboutsummaryrefslogtreecommitdiffstats
path: root/libarchive/archive_read_add_passphrase.c
diff options
context:
space:
mode:
Diffstat (limited to 'libarchive/archive_read_add_passphrase.c')
-rw-r--r--libarchive/archive_read_add_passphrase.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libarchive/archive_read_add_passphrase.c b/libarchive/archive_read_add_passphrase.c
index cf821b5d483c..f0b1ab93300f 100644
--- a/libarchive/archive_read_add_passphrase.c
+++ b/libarchive/archive_read_add_passphrase.c
@@ -57,6 +57,10 @@ insert_passphrase_to_head(struct archive_read *a,
{
p->next = a->passphrases.first;
a->passphrases.first = p;
+ if (&a->passphrases.first == a->passphrases.last) {
+ a->passphrases.last = &p->next;
+ p->next = NULL;
+ }
}
static struct archive_read_passphrase *