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>
bb10
Ivan Komissarov 2018-10-21 16:01:26 +02:00
parent b688c7e99a
commit 177577932e
1 changed files with 2 additions and 2 deletions

View File

@ -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);