Fix GetWindowsErrSz nullptr bug (#10282)
Summary: `GetWindowsErrSz` may assign a `nullptr` to `std::string` in the event it cannot format the error code to a string. This will result in a crash when `std::string` attempts to calculate the length from `nullptr`. The change here checks the output from `FormatMessageA` and only assigns to the otuput `std::string` if it is not null. Additionally, the call to free the buffer is only made if a non-null value is returned from `FormatMessageA`. In the event `FormatMessageA` does not output a string, an empty string is returned instead. Fixes https://github.com/facebook/rocksdb/issues/10274 Pull Request resolved: https://github.com/facebook/rocksdb/pull/10282 Reviewed By: riversand963 Differential Revision: D37542143 Pulled By: ajkr fbshipit-source-id: c21f5119ddb451f76960acec94639d0f538052f2main
parent
490fcac078
commit
c2dc4c0c52
Loading…
Reference in new issue