Coverity complained that mapSize was used in ~FdWrapper uninitialized when the object was destroyed before map() had been called on it. This is a False Positive, because in that case, ptr == MAP_FAILED, and we wouldn't be reading mapSize. But be nice and split the FdWrapper class into two, by creating an object managing only the mmap() part of equation and returning it from map(). The most-natural choice for such an object would be a unique_ptr with a custom deleter, but that has built-in knowledge of nullptr (ie. doesn't call the deleter on nullptr), which, at least theoretically, is a valid return value of mmap() (the error case is (void*)-1), so write a small struct ourselves. Coverity-Id: 390668 Pick-to: 6.8 6.5 Change-Id: I43d635617bd26120cf402241bf59680fe63d071a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit 1d2dda041a419740dff16dbb4addc6d93583f08d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
…
Description
Languages
C++
84.3%
HTML
4.9%
C
3.9%
CMake
3.6%
Objective-C++
2%
Other
0.8%