mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-01 12:36:56 +00:00
The default rapidjson allocator returns nullptr from a failed allocation or reallocation. It's not a bug by itself, but rapidjson internals usually don't check for these return values and happily use nullptr as a valid pointer, which leads to segmentation faults and memory corruptions. In order to prevent these bugs, the default allocator is wrapped with a class which simply throws once it fails to allocate or reallocate memory, thus preventing the use of nullptr in the code. One exception is Malloc/Realloc with size 0, which is expected to return nullptr by rapidjson code.
18 KiB
18 KiB