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:
Sudarshan Bisht 2011-04-12 13:09:45 +03:00 committed by Takashi Iwai
parent 6bb36928b1
commit 808ce5deb3
7 changed files with 11 additions and 5 deletions

View file

@ -201,6 +201,7 @@ static int snd_rawmidi_open_conf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp
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) {

View file

@ -383,9 +383,11 @@ int snd_rawmidi_virtual_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
_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)