OpenSound: Fix PVS 2232, 2233

Use new(std::nothrow) so that NULL check for allocated memory
makes sense.

Change-Id: I690a796ac5a9a7a61440ccccf19f93fc6bf2d328
Reviewed-on: https://review.haiku-os.org/689
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Murai Takashi
2018-11-13 19:58:08 +00:00
committed by waddlesplash
parent 05f730b0f8
commit 99b0a7e0ed
@@ -389,7 +389,8 @@ OpenSoundDevice::AddEngine(oss_audioinfo *info)
if (info->caps & PCM_CAP_HIDDEN)
return B_OK;
*/
OpenSoundDeviceEngine *engine = new OpenSoundDeviceEngine(info);
OpenSoundDeviceEngine *engine =
new(std::nothrow) OpenSoundDeviceEngine(info);
if (!engine)
return ENOMEM;
err = engine->InitCheck();
@@ -407,7 +408,8 @@ OpenSoundDevice::AddMixer(oss_mixerinfo *info)
{
status_t err;
CALLED();
OpenSoundDeviceMixer *mixer = new OpenSoundDeviceMixer(info);
OpenSoundDeviceMixer *mixer =
new(std::nothrow) OpenSoundDeviceMixer(info);
if (!mixer)
return ENOMEM;
err = mixer->InitCheck();