fix: segmentation fault, non initialized pointers in dictziplib.hpp

In method void DictData::close() both if (this->chunks) and if (this->offsets) checks can pass even if no allocated memory is assigned to pointers, because both pointers were not initialized to anything, it is UB, so free were called on uninitialized values. Initializing both values to nullptr guarantees that both checks will fail if pointers were not modified, and free is not called.
This commit is contained in:
Mark Mandriota
2025-12-16 19:48:35 +01:00
committed by Evgeniy Dushistov
parent 5478f290a1
commit bae2132bd5

View File

@@ -18,7 +18,10 @@ class DictData
public:
static const size_t DICT_CACHE_SIZE = 5;
DictData() {}
DictData() {
this->chunks = nullptr;
this->offsets = nullptr;
}
~DictData() { close(); }
bool open(const std::string &filename, int computeCRC);
void close();