Coverity Static Analysis helps developers find hard-to-spot,
yet potentially crash-causing defects early in the development phase,
reducing the cost,time, and risk of software errors.
This patch has fix for situations where variable can be NULL
but not been checked beforehand
Signed-off-by: Takashi Iwai <tiwai@suse.de>
__error:
if (initflag)
free(priv);
- if (h == NULL)
+ if (h)
snd_dlclose(h);
free(xlib);
return -ENXIO;
snd_config_iterator_t i, next;
if (snd_config_get_type(func_conf) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("Invalid type for func %s definition", str);
+ err = -EINVAL;
goto _err;
}
snd_config_for_each(i, next, func_conf) {
if (err >= 0) {
if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("Invalid type for HWDEP type %s definition", str);
+ err = -EINVAL;
goto _err;
}
snd_config_for_each(i, next, type_conf) {
if (err >= 0) {
if (snd_config_get_type(type) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("Invalid type for PCM type %s definition", str);
+ err = -EINVAL;
goto _err;
}
snd_config_for_each(i, next, type) {
return err;
if (periods == 1)
return -EINVAL;
- if (*period_time == 0) {
+ if (period_time) {
err = INTERNAL(snd_pcm_hw_params_get_period_time)(hw_params, period_time, NULL);
if (err < 0)
return err;
if (err >= 0) {
if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("Invalid type for RAWMIDI type %s definition", str);
+ err = -EINVAL;
goto _err;
}
snd_config_for_each(i, next, type_conf) {
_err:
if (seq_handle)
snd_seq_close(seq_handle);
- if (virt->midi_event)
- snd_midi_event_free(virt->midi_event);
- free(virt);
+ if (virt) {
+ if (virt->midi_event)
+ snd_midi_event_free(virt->midi_event);
+ free(virt);
+ }
if (inputp)
free(*inputp);
if (outputp)