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
|
|
@ -94,8 +94,7 @@ int snd_ctl_close(snd_ctl_t *ctl)
|
|||
snd_async_del_handler(h);
|
||||
}
|
||||
err = ctl->ops->close(ctl);
|
||||
if (ctl->name)
|
||||
free(ctl->name);
|
||||
free(ctl->name);
|
||||
if (ctl->dl_handle)
|
||||
snd_dlclose(ctl->dl_handle);
|
||||
free(ctl);
|
||||
|
|
@ -925,8 +924,7 @@ const char *snd_ctl_event_type_name(snd_ctl_event_type_t type)
|
|||
*/
|
||||
int snd_ctl_elem_list_alloc_space(snd_ctl_elem_list_t *obj, unsigned int entries)
|
||||
{
|
||||
if (obj->pids)
|
||||
free(obj->pids);
|
||||
free(obj->pids);
|
||||
obj->pids = calloc(entries, sizeof(*obj->pids));
|
||||
if (!obj->pids) {
|
||||
obj->space = 0;
|
||||
|
|
|
|||
|
|
@ -555,8 +555,7 @@ int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *sockname
|
|||
close(sock);
|
||||
if (ctrl)
|
||||
shmdt(ctrl);
|
||||
if (shm)
|
||||
free(shm);
|
||||
free(shm);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -606,8 +606,7 @@ int snd_hctl_load(snd_hctl_t *hctl)
|
|||
}
|
||||
err = snd_ctl_subscribe_events(hctl->ctl, 1);
|
||||
_end:
|
||||
if (list.pids)
|
||||
free(list.pids);
|
||||
free(list.pids);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue