mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-05 13:30:00 -05:00
remove superfluous free() checks
free() correctly handles NULL pointers, so we can omit explicit checks for that condition.
This commit is contained in:
parent
45850439b3
commit
4433248bf3
33 changed files with 108 additions and 205 deletions
|
|
@ -342,8 +342,7 @@ int snd_rawmidi_close(snd_rawmidi_t *rawmidi)
|
|||
int err;
|
||||
assert(rawmidi);
|
||||
err = rawmidi->ops->close(rawmidi);
|
||||
if (rawmidi->name)
|
||||
free(rawmidi->name);
|
||||
free(rawmidi->name);
|
||||
if (rawmidi->dl_handle)
|
||||
snd_dlclose(rawmidi->dl_handle);
|
||||
free(rawmidi);
|
||||
|
|
|
|||
|
|
@ -316,11 +316,10 @@ int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
|
|||
|
||||
_nomem:
|
||||
close(fd);
|
||||
if (hw)
|
||||
free(hw);
|
||||
if (inputp && *inputp)
|
||||
free(hw);
|
||||
if (inputp)
|
||||
free(*inputp);
|
||||
if (outputp && *outputp)
|
||||
if (outputp)
|
||||
free(*outputp);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -385,11 +385,10 @@ int snd_rawmidi_virtual_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
|
|||
snd_seq_close(seq_handle);
|
||||
if (virt->midi_event)
|
||||
snd_midi_event_free(virt->midi_event);
|
||||
if (virt)
|
||||
free(virt);
|
||||
if (inputp && *inputp)
|
||||
free(virt);
|
||||
if (inputp)
|
||||
free(*inputp);
|
||||
if (outputp && *outputp)
|
||||
if (outputp)
|
||||
free(*outputp);
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue