fixed from PVS-Studio

V668 There is no sense in testing the 'penv' pointer against null, as the memory was allocated using the 'new' operator. The exception will be generated in the case of memory allocation error. load_dbm.cpp 148
pull/20/head
ip_gpu 9 years ago
parent 77938cd0be
commit 94aec516ac

@ -145,7 +145,13 @@ BOOL CSoundFile::ReadDBM(const BYTE *lpStream, DWORD dwMemLength)
UINT nsmp;
if (chunk_pos + sizeof(DBMINSTRUMENT) > dwMemPos) break;
if ((penv = new INSTRUMENTHEADER) == NULL) break;
try {
penv = new INSTRUMENTHEADER;
}
catch (std::bad_alloc& ba) {
break;
}
pih = (DBMINSTRUMENT *)(lpStream+chunk_pos);
nsmp = bswapBE16(pih->sampleno);
psmp = ((nsmp) && (nsmp < MAX_SAMPLES)) ? &Ins[nsmp] : NULL;

Loading…
Cancel
Save