A report from ASAN build has shown a bug while freeing a storage.
When a dumping reader was created with no available logs it
was disconnected from storage, but put into waiting_readers.
This commit changes log_storage_new_reader() in a way that
a reader is added to waiting_readers only if it is connected
to the storage.
Change-Id: Id6033fe73e86674384feb2fafb9b3814f0f0b73e
reader->user_data = user_data;
reader->current = NULL;
reader->counter = storage->counter_begin;
- list_add(&storage->waiting_readers, reader);
reader->final = NULL;
if (dumping) {
// but in case there are no logs - we have nothing to do
reader->storage = NULL;
}
+
+ if (NULL != reader->storage)
+ list_add(&storage->waiting_readers, reader);
}
return reader;
}