mirror of
https://gitee.com/openharmony/third_party_alsa-lib
synced 2024-11-27 01:31:08 +00:00
alsa-lib: fixed coverity reported issues under "FORWARD_NULL" checker.
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>
This commit is contained in:
parent
6bb36928b1
commit
808ce5deb3
@ -99,7 +99,7 @@ int mixer_simple_basic_dlopen(snd_mixer_class_t *class,
|
|||||||
__error:
|
__error:
|
||||||
if (initflag)
|
if (initflag)
|
||||||
free(priv);
|
free(priv);
|
||||||
if (h == NULL)
|
if (h)
|
||||||
snd_dlclose(h);
|
snd_dlclose(h);
|
||||||
free(xlib);
|
free(xlib);
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
|
@ -3268,6 +3268,7 @@ static int snd_config_hooks_call(snd_config_t *root, snd_config_t *config, snd_c
|
|||||||
snd_config_iterator_t i, next;
|
snd_config_iterator_t i, next;
|
||||||
if (snd_config_get_type(func_conf) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(func_conf) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
SNDERR("Invalid type for func %s definition", str);
|
SNDERR("Invalid type for func %s definition", str);
|
||||||
|
err = -EINVAL;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
snd_config_for_each(i, next, func_conf) {
|
snd_config_for_each(i, next, func_conf) {
|
||||||
|
@ -78,6 +78,7 @@ static int snd_hwdep_open_conf(snd_hwdep_t **hwdep,
|
|||||||
if (err >= 0) {
|
if (err >= 0) {
|
||||||
if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
SNDERR("Invalid type for HWDEP type %s definition", str);
|
SNDERR("Invalid type for HWDEP type %s definition", str);
|
||||||
|
err = -EINVAL;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
snd_config_for_each(i, next, type_conf) {
|
snd_config_for_each(i, next, type_conf) {
|
||||||
|
@ -385,6 +385,7 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
|
|||||||
if (err >= 0) {
|
if (err >= 0) {
|
||||||
if (snd_config_get_type(type) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(type) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
SNDERR("Invalid type for PCM type %s definition", str);
|
SNDERR("Invalid type for PCM type %s definition", str);
|
||||||
|
err = -EINVAL;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
snd_config_for_each(i, next, type) {
|
snd_config_for_each(i, next, type) {
|
||||||
|
@ -89,7 +89,7 @@ static int set_hw_params(snd_pcm_t *pcm,
|
|||||||
return err;
|
return err;
|
||||||
if (periods == 1)
|
if (periods == 1)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (*period_time == 0) {
|
if (period_time) {
|
||||||
err = INTERNAL(snd_pcm_hw_params_get_period_time)(hw_params, period_time, NULL);
|
err = INTERNAL(snd_pcm_hw_params_get_period_time)(hw_params, period_time, NULL);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
@ -201,6 +201,7 @@ static int snd_rawmidi_open_conf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp
|
|||||||
if (err >= 0) {
|
if (err >= 0) {
|
||||||
if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
SNDERR("Invalid type for RAWMIDI type %s definition", str);
|
SNDERR("Invalid type for RAWMIDI type %s definition", str);
|
||||||
|
err = -EINVAL;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
snd_config_for_each(i, next, type_conf) {
|
snd_config_for_each(i, next, type_conf) {
|
||||||
|
@ -383,9 +383,11 @@ int snd_rawmidi_virtual_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
|
|||||||
_err:
|
_err:
|
||||||
if (seq_handle)
|
if (seq_handle)
|
||||||
snd_seq_close(seq_handle);
|
snd_seq_close(seq_handle);
|
||||||
if (virt->midi_event)
|
if (virt) {
|
||||||
snd_midi_event_free(virt->midi_event);
|
if (virt->midi_event)
|
||||||
free(virt);
|
snd_midi_event_free(virt->midi_event);
|
||||||
|
free(virt);
|
||||||
|
}
|
||||||
if (inputp)
|
if (inputp)
|
||||||
free(*inputp);
|
free(*inputp);
|
||||||
if (outputp)
|
if (outputp)
|
||||||
|
Loading…
Reference in New Issue
Block a user