diff options
author | Ivan Komissarov <ABBAPOH@gmail.com> | 2018-10-21 16:01:26 +0200 |
---|---|---|
committer | Ivan Komissarov <ABBAPOH@gmail.com> | 2018-12-10 21:15:09 +0000 |
commit | 177577932e89772ef7ab281dd5771d5c66ad3a93 (patch) | |
tree | cb53bf73d08d83bacbc106a80769ccfe845ef723 /src/plugins/styles | |
parent | b688c7e99a8def9db836d1d6ab7388ae14a5d5b0 (diff) |
qwindowsxpstyle: Add std::nothrow to new
There is no sense in testing the 'buf' pointer against null, as the
memory was allocated using the throwing 'new' operator. However, since
this function already can fail in other cases, the 'buf' pointer can be
checked for nullptr after the nothrow new.
Task-number: QTBUG-71156
Change-Id: Ibca5d672544d3980dd8890474e3e2fbf7443e05d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/plugins/styles')
-rw-r--r-- | src/plugins/styles/windowsvista/qwindowsxpstyle.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp index 4b583e13d3..43e8b37f71 100644 --- a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp @@ -511,8 +511,8 @@ QRegion QWindowsXPStylePrivate::region(XPThemeData &themeData) if (numBytes == 0) return QRegion(); - char *buf = new char[numBytes]; - if (buf == 0) + char *buf = new (std::nothrow) char[numBytes]; + if (!buf) return QRegion(); RGNDATA *rd = reinterpret_cast<RGNDATA*>(buf); |