]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Linpool: State restoration works in initial linpool state
authorMaria Matejka <mq@ucw.cz>
Tue, 28 Feb 2023 14:19:21 +0000 (15:19 +0100)
committerMaria Matejka <mq@ucw.cz>
Tue, 4 Apr 2023 15:00:59 +0000 (17:00 +0200)
lib/mempool.c

index 33eaec86abd5f79c8f5d9f36c6eef16b9e7bfb57..d10f8f1c218873653cbf306ee1ee4f3a4dd8f415 100644 (file)
@@ -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))