summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2023-02-28 15:19:21 +0100
committerMaria Matejka <mq@ucw.cz>2023-04-04 17:00:59 +0200
commit8e6abea41eca5c18b03e46706cbfa2972085f954 (patch)
tree0c05766ec6b9bb7b07a0a11fd45862327daed9d8 /lib
parentd16321686eeda23eed53fa83d40099c2607c5c2c (diff)
Linpool: State restoration works in initial linpool state
Diffstat (limited to 'lib')
-rw-r--r--lib/mempool.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/mempool.c b/lib/mempool.c
index 33eaec86..d10f8f1c 100644
--- a/lib/mempool.c
+++ b/lib/mempool.c
@@ -231,9 +231,9 @@ lp_restore(linpool *m, lp_state *p)
struct lp_chunk *c;
/* Move ptr to the saved pos and free all newer large chunks */
- m->current = c = p->current;
- m->ptr = p->ptr;
- m->end = c ? c->data + LP_DATA_SIZE : NULL;
+ m->current = c = p->current ?: m->first;
+ m->ptr = p->ptr ?: (c ? c->data : NULL);
+ m->end = c ? (c->data + LP_DATA_SIZE) : NULL;
m->total_large = p->total_large;
while ((c = m->first_large) && (c != p->large))