13
0

Fix potential malloc(0) issue

This commit is contained in:
Robin Gareus 2020-05-05 16:49:51 +02:00
parent a0f05e6dda
commit c75b2355c1
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -80,7 +80,9 @@ AlsaAudioSlave::AlsaAudioSlave (
_play_buff = (float*) malloc (sizeof(float) * _pcmi.nplay () * _samples_per_period);
}
_src_buff = (float*) malloc (sizeof(float) * std::max (_pcmi.nplay (), _pcmi.ncapt ()));
if (_pcmi.nplay () > 0 || _pcmi.ncapt () > 0) {
_src_buff = (float*) malloc (sizeof(float) * std::max (_pcmi.nplay (), _pcmi.ncapt ()));
}
}
AlsaAudioSlave::~AlsaAudioSlave ()