diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2022-02-14 10:29:24 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2022-02-15 12:05:33 +0100 |
commit | 06e45cbd6a2e09bc32cb1c9aa3779d6bd5282c45 (patch) | |
tree | ae0ef84a0c26df963a1c53567a2fc9d7416c11f1 /tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp | |
parent | e1b76e68d0dae2eff00dc70fe56ca5e6029045e6 (diff) |
QFileSystemEngine::canonicalName (Unix): clean up control-flow
When passing a nullptr to realpath, it will allocate memory. That memory
has to be freed (with free) later to avoid a leak, which we so far
didn't.
This patch ensures that we always clean up the memory by using a
unique_ptr. As a drive-by, clean up the control-flow:
- Always pass either the stack buffer or nullptr to realpath.
- Rely on realpath returning nullptr in the error case.
Lastly, fix a few coding-style issues.
Change-Id: Ia906df77324020c267b087ec52a9a6c47aaa2a59
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp')
0 files changed, 0 insertions, 0 deletions