Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH v6 1/1] box: fix checkpoint_delete
@ 2018-12-06 12:25 Kirill Shcherbatov
  2018-12-06 12:38 ` Vladislav Shpilevoy
  2018-12-06 13:00 ` Vladimir Davydov
  0 siblings, 2 replies; 3+ messages in thread
From: Kirill Shcherbatov @ 2018-12-06 12:25 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy; +Cc: Kirill Shcherbatov

http://github.com/tarantool/tarantool/tree/kshch/gh-3858-fix-checkpoint-delete
https://github.com/tarantool/tarantool/issues/3858

The rlist_foreach_entry iterator was used for freeing resources.
As a result there was dirty access to memory during next step of
for-loop.
Replaced with rlist_foreach_entry_safe valid for destructors.

Closes #3858
---
 src/box/memtx_engine.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/box/memtx_engine.c b/src/box/memtx_engine.c
index 9e05ecf63..5cf70ab94 100644
--- a/src/box/memtx_engine.c
+++ b/src/box/memtx_engine.c
@@ -610,8 +610,8 @@ checkpoint_new(const char *snap_dirname, uint64_t snap_io_rate_limit)
 static void
 checkpoint_delete(struct checkpoint *ckpt)
 {
-	struct checkpoint_entry *entry;
-	rlist_foreach_entry(entry, &ckpt->entries, link) {
+	struct checkpoint_entry *entry, *tmp;
+	rlist_foreach_entry_safe(entry, &ckpt->entries, link, tmp) {
 		entry->iterator->free(entry->iterator);
 		free(entry);
 	}
-- 
2.19.2

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-12-06 13:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-06 12:25 [tarantool-patches] [PATCH v6 1/1] box: fix checkpoint_delete Kirill Shcherbatov
2018-12-06 12:38 ` Vladislav Shpilevoy
2018-12-06 13:00 ` Vladimir Davydov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox