Fix potential malloc(0) issue
This commit is contained in:
parent
a0f05e6dda
commit
c75b2355c1
@ -80,8 +80,10 @@ AlsaAudioSlave::AlsaAudioSlave (
|
|||||||
_play_buff = (float*) malloc (sizeof(float) * _pcmi.nplay () * _samples_per_period);
|
_play_buff = (float*) malloc (sizeof(float) * _pcmi.nplay () * _samples_per_period);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_pcmi.nplay () > 0 || _pcmi.ncapt () > 0) {
|
||||||
_src_buff = (float*) malloc (sizeof(float) * std::max (_pcmi.nplay (), _pcmi.ncapt ()));
|
_src_buff = (float*) malloc (sizeof(float) * std::max (_pcmi.nplay (), _pcmi.ncapt ()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
AlsaAudioSlave::~AlsaAudioSlave ()
|
AlsaAudioSlave::~AlsaAudioSlave ()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user