mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04: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
|
|
@ -165,8 +165,7 @@ static void free_object(struct alisp_object * p)
|
|||
switch (alisp_get_type(p)) {
|
||||
case ALISP_OBJ_STRING:
|
||||
case ALISP_OBJ_IDENTIFIER:
|
||||
if (p->value.s)
|
||||
free(p->value.s);
|
||||
free(p->value.s);
|
||||
alisp_set_type(p, ALISP_OBJ_INTEGER);
|
||||
break;
|
||||
default:
|
||||
|
|
@ -523,8 +522,7 @@ static int init_lex(struct alisp_instance *instance)
|
|||
|
||||
static void done_lex(struct alisp_instance *instance)
|
||||
{
|
||||
if (instance->token_buffer)
|
||||
free(instance->token_buffer);
|
||||
free(instance->token_buffer);
|
||||
}
|
||||
|
||||
static char * extend_buf(struct alisp_instance *instance, char *p)
|
||||
|
|
@ -1184,8 +1182,7 @@ static struct alisp_object * F_concat(struct alisp_instance *instance, struct al
|
|||
str1 = realloc(str, (str ? strlen(str) : 0) + strlen(p1->value.s) + 1);
|
||||
if (str1 == NULL) {
|
||||
nomem();
|
||||
if (str)
|
||||
free(str);
|
||||
free(str);
|
||||
return NULL;
|
||||
}
|
||||
if (str == NULL)
|
||||
|
|
@ -2366,8 +2363,7 @@ static struct alisp_object * eval_func(struct alisp_instance *instance, struct a
|
|||
}
|
||||
|
||||
_end:
|
||||
if (eval_objs)
|
||||
free(eval_objs);
|
||||
free(eval_objs);
|
||||
|
||||
return p4;
|
||||
} else {
|
||||
|
|
|
|||
48
src/conf.c
48
src/conf.c
|
|
@ -980,8 +980,7 @@ static int parse_value(snd_config_t **_n, snd_config_t *father, input_t *input,
|
|||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
if (n->u.string)
|
||||
free(n->u.string);
|
||||
free(n->u.string);
|
||||
n->u.string = s;
|
||||
*_n = n;
|
||||
return 0;
|
||||
|
|
@ -1056,8 +1055,7 @@ static int parse_array_def(snd_config_t *father, input_t *input, int idx, int sk
|
|||
}
|
||||
err = 0;
|
||||
__end:
|
||||
if (id)
|
||||
free(id);
|
||||
free(id);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -1218,8 +1216,7 @@ static int parse_def(snd_config_t *father, input_t *input, int skip, int overrid
|
|||
unget_char(c, input);
|
||||
}
|
||||
__end:
|
||||
if (id)
|
||||
free(id);
|
||||
free(id);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -1446,8 +1443,7 @@ int snd_config_substitute(snd_config_t *dst, snd_config_t *src)
|
|||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
if (dst->id)
|
||||
free(dst->id);
|
||||
free(dst->id);
|
||||
dst->id = src->id;
|
||||
dst->type = src->type;
|
||||
dst->u = src->u;
|
||||
|
|
@ -1528,8 +1524,7 @@ int snd_config_set_id(snd_config_t *config, const char *id)
|
|||
new_id = strdup(id);
|
||||
if (!new_id)
|
||||
return -ENOMEM;
|
||||
if (config->id)
|
||||
free(config->id);
|
||||
free(config->id);
|
||||
config->id = new_id;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1696,16 +1691,14 @@ int snd_config_delete(snd_config_t *config)
|
|||
break;
|
||||
}
|
||||
case SND_CONFIG_TYPE_STRING:
|
||||
if (config->u.string)
|
||||
free(config->u.string);
|
||||
free(config->u.string);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (config->father)
|
||||
list_del(&config->list);
|
||||
if (config->id)
|
||||
free(config->id);
|
||||
free(config->id);
|
||||
free(config);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -2023,8 +2016,7 @@ int snd_config_set_string(snd_config_t *config, const char *value)
|
|||
} else {
|
||||
new_string = NULL;
|
||||
}
|
||||
if (config->u.string)
|
||||
free(config->u.string);
|
||||
free(config->u.string);
|
||||
config->u.string = new_string;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -2091,8 +2083,7 @@ int snd_config_set_ascii(snd_config_t *config, const char *ascii)
|
|||
char *ptr = strdup(ascii);
|
||||
if (ptr == NULL)
|
||||
return -ENOMEM;
|
||||
if (config->u.string)
|
||||
free(config->u.string);
|
||||
free(config->u.string);
|
||||
config->u.string = ptr;
|
||||
}
|
||||
break;
|
||||
|
|
@ -2702,8 +2693,7 @@ static int snd_config_hooks_call(snd_config_t *root, snd_config_t *config, snd_c
|
|||
if (err >= 0 && nroot)
|
||||
err = snd_config_substitute(root, nroot);
|
||||
}
|
||||
if (buf)
|
||||
free(buf);
|
||||
free(buf);
|
||||
if (err < 0)
|
||||
return err;
|
||||
return 0;
|
||||
|
|
@ -2844,11 +2834,10 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t
|
|||
*dst = NULL;
|
||||
err = 0;
|
||||
_err:
|
||||
for (idx = 0; idx < fi_count; idx++)
|
||||
if (fi[idx].name)
|
||||
free(fi[idx].name);
|
||||
if (fi)
|
||||
free(fi);
|
||||
if (fi)
|
||||
for (idx = 0; idx < fi_count; idx++)
|
||||
free(fi[idx].name);
|
||||
free(fi);
|
||||
snd_config_delete(n);
|
||||
return err;
|
||||
}
|
||||
|
|
@ -2905,8 +2894,7 @@ int snd_config_hook_load_for_all_cards(snd_config_t *root, snd_config_t *config,
|
|||
__err:
|
||||
if (private_data)
|
||||
snd_config_delete(private_data);
|
||||
if (fdriver)
|
||||
free(fdriver);
|
||||
free(fdriver);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
|
|
@ -3108,8 +3096,7 @@ int snd_config_update_free(snd_config_update_t *update)
|
|||
assert(update);
|
||||
for (k = 0; k < update->count; k++)
|
||||
free(update->finfo[k].name);
|
||||
if (update->finfo)
|
||||
free(update->finfo);
|
||||
free(update->finfo);
|
||||
free(update);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -3500,8 +3487,7 @@ static int _snd_config_evaluate(snd_config_t *src,
|
|||
}
|
||||
}
|
||||
_errbuf:
|
||||
if (buf)
|
||||
free(buf);
|
||||
free(buf);
|
||||
if (err < 0)
|
||||
return err;
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -295,8 +295,7 @@ int snd_func_getenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
free(res);
|
||||
}
|
||||
__error:
|
||||
if (def)
|
||||
free(def);
|
||||
free(def);
|
||||
return err;
|
||||
}
|
||||
#ifndef DOC_HIDDEN
|
||||
|
|
@ -419,8 +418,7 @@ int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
tmp = realloc(res, len + len1 + 1);
|
||||
if (tmp == NULL) {
|
||||
free(ptr);
|
||||
if (res)
|
||||
free(res);
|
||||
free(res);
|
||||
err = -ENOMEM;
|
||||
goto __error;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -207,8 +207,7 @@ int snd_hwdep_close(snd_hwdep_t *hwdep)
|
|||
int err;
|
||||
assert(hwdep);
|
||||
err = hwdep->ops->close(hwdep);
|
||||
if (hwdep->name)
|
||||
free(hwdep->name);
|
||||
free(hwdep->name);
|
||||
free(hwdep);
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -382,12 +382,9 @@ int snd_instr_iwffff_close(snd_iwffff_handle_t *handle)
|
|||
{
|
||||
if (handle == NULL)
|
||||
return -EINVAL;
|
||||
if (handle->dat_filename)
|
||||
free(handle->dat_filename);
|
||||
if (handle->fff_filename)
|
||||
free(handle->fff_filename);
|
||||
if (handle->fff_data)
|
||||
free(handle->fff_data);
|
||||
free(handle->dat_filename);
|
||||
free(handle->fff_filename);
|
||||
free(handle->fff_data);
|
||||
free(handle);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -396,8 +393,7 @@ static void free_wave(iwffff_wave_t *wave)
|
|||
{
|
||||
if (wave == NULL)
|
||||
return;
|
||||
if (wave->address.ptr != NULL)
|
||||
free(wave->address.ptr);
|
||||
free(wave->address.ptr);
|
||||
free(wave);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -607,10 +607,8 @@ int snd_mixer_close(snd_mixer_t *mixer)
|
|||
}
|
||||
assert(list_empty(&mixer->elems));
|
||||
assert(mixer->count == 0);
|
||||
if (mixer->pelems) {
|
||||
free(mixer->pelems);
|
||||
mixer->pelems = NULL;
|
||||
}
|
||||
free(mixer->pelems);
|
||||
mixer->pelems = NULL;
|
||||
while (!list_empty(&mixer->slaves)) {
|
||||
int err;
|
||||
snd_mixer_slave_t *s;
|
||||
|
|
|
|||
|
|
@ -182,8 +182,7 @@ static void private_free(snd_mixer_class_t *class)
|
|||
snd_hctl_close(priv->hctl);
|
||||
} else if (priv->ctl)
|
||||
snd_ctl_close(priv->ctl);
|
||||
if (priv->device)
|
||||
free(priv->device);
|
||||
free(priv->device);
|
||||
free(priv);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1388,8 +1388,7 @@ int snd_mixer_simple_none_register(snd_mixer_t *mixer,
|
|||
snd_mixer_class_set_compare(class, snd_mixer_selem_compare);
|
||||
err = snd_mixer_class_register(class, mixer);
|
||||
if (err < 0) {
|
||||
if (class)
|
||||
free(class);
|
||||
free(class);
|
||||
return err;
|
||||
}
|
||||
if (classp)
|
||||
|
|
|
|||
15
src/names.c
15
src/names.c
|
|
@ -105,17 +105,14 @@ static int names_parse(snd_config_t *top, const char *iface, snd_devname_t **lis
|
|||
}
|
||||
last = dn;
|
||||
} else {
|
||||
if (comment != NULL)
|
||||
free(comment);
|
||||
free(comment);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
_err:
|
||||
if (name)
|
||||
free(name);
|
||||
if (comment)
|
||||
free(comment);
|
||||
free(name);
|
||||
free(comment);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -189,10 +186,8 @@ void snd_names_list_free(snd_devname_t *list)
|
|||
|
||||
while (list != NULL) {
|
||||
next = list->next;
|
||||
if (list->name)
|
||||
free(list->name);
|
||||
if (list->comment)
|
||||
free(list->comment);
|
||||
free(list->name);
|
||||
free(list->comment);
|
||||
free(list);
|
||||
list = next;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2102,10 +2102,8 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
|
|||
}
|
||||
if (type_conf)
|
||||
snd_config_delete(type_conf);
|
||||
if (buf)
|
||||
free(buf);
|
||||
if (buf1)
|
||||
free(buf1);
|
||||
free(buf);
|
||||
free(buf1);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -2187,12 +2185,9 @@ int snd_pcm_new(snd_pcm_t **pcmp, snd_pcm_type_t type, const char *name,
|
|||
int snd_pcm_free(snd_pcm_t *pcm)
|
||||
{
|
||||
assert(pcm);
|
||||
if (pcm->name)
|
||||
free(pcm->name);
|
||||
if (pcm->hw.link_dst)
|
||||
free(pcm->hw.link_dst);
|
||||
if (pcm->appl.link_dst)
|
||||
free(pcm->appl.link_dst);
|
||||
free(pcm->name);
|
||||
free(pcm->hw.link_dst);
|
||||
free(pcm->appl.link_dst);
|
||||
if (pcm->dl_handle)
|
||||
snd_dlclose(pcm->dl_handle);
|
||||
free(pcm);
|
||||
|
|
|
|||
|
|
@ -449,10 +449,8 @@ static int snd_pcm_adpcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
|||
static int snd_pcm_adpcm_hw_free(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_adpcm_t *adpcm = pcm->private_data;
|
||||
if (adpcm->states) {
|
||||
free(adpcm->states);
|
||||
adpcm->states = 0;
|
||||
}
|
||||
free(adpcm->states);
|
||||
adpcm->states = NULL;
|
||||
return snd_pcm_hw_free(adpcm->plug.gen.slave);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -639,8 +639,7 @@ static int snd_pcm_dmix_close(snd_pcm_t *pcm)
|
|||
shm_sum_discard(dmix);
|
||||
snd_pcm_direct_shm_discard(dmix);
|
||||
snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
|
||||
if (dmix->bindings)
|
||||
free(dmix->bindings);
|
||||
free(dmix->bindings);
|
||||
pcm->private_data = NULL;
|
||||
free(dmix);
|
||||
return 0;
|
||||
|
|
@ -941,8 +940,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
|
|||
snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
|
||||
_err_nosem:
|
||||
if (dmix) {
|
||||
if (dmix->bindings)
|
||||
free(dmix->bindings);
|
||||
free(dmix->bindings);
|
||||
free(dmix);
|
||||
}
|
||||
if (pcm)
|
||||
|
|
|
|||
|
|
@ -466,8 +466,7 @@ static int snd_pcm_dshare_close(snd_pcm_t *pcm)
|
|||
snd_pcm_direct_client_discard(dshare);
|
||||
snd_pcm_direct_shm_discard(dshare);
|
||||
snd_pcm_direct_semaphore_up(dshare, DIRECT_IPC_SEM_CLIENT);
|
||||
if (dshare->bindings)
|
||||
free(dshare->bindings);
|
||||
free(dshare->bindings);
|
||||
pcm->private_data = NULL;
|
||||
free(dshare);
|
||||
return 0;
|
||||
|
|
@ -763,8 +762,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
|||
snd_pcm_direct_semaphore_up(dshare, DIRECT_IPC_SEM_CLIENT);
|
||||
_err_nosem:
|
||||
if (dshare) {
|
||||
if (dshare->bindings)
|
||||
free(dshare->bindings);
|
||||
free(dshare->bindings);
|
||||
free(dshare);
|
||||
}
|
||||
if (pcm)
|
||||
|
|
|
|||
|
|
@ -362,8 +362,7 @@ static int snd_pcm_dsnoop_close(snd_pcm_t *pcm)
|
|||
snd_pcm_direct_client_discard(dsnoop);
|
||||
snd_pcm_direct_shm_discard(dsnoop);
|
||||
snd_pcm_direct_semaphore_up(dsnoop, DIRECT_IPC_SEM_CLIENT);
|
||||
if (dsnoop->bindings)
|
||||
free(dsnoop->bindings);
|
||||
free(dsnoop->bindings);
|
||||
pcm->private_data = NULL;
|
||||
free(dsnoop);
|
||||
return 0;
|
||||
|
|
@ -636,8 +635,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
|
|||
snd_pcm_direct_semaphore_up(dsnoop, DIRECT_IPC_SEM_CLIENT);
|
||||
_err_nosem:
|
||||
if (dsnoop) {
|
||||
if (dsnoop->bindings)
|
||||
free(dsnoop->bindings);
|
||||
free(dsnoop->bindings);
|
||||
free(dsnoop);
|
||||
}
|
||||
if (pcm)
|
||||
|
|
|
|||
|
|
@ -263,13 +263,10 @@ static snd_pcm_sframes_t snd_pcm_file_mmap_commit(snd_pcm_t *pcm,
|
|||
static int snd_pcm_file_hw_free(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
if (file->wbuf) {
|
||||
free(file->wbuf);
|
||||
if (file->wbuf_areas)
|
||||
free(file->wbuf_areas);
|
||||
file->wbuf = 0;
|
||||
file->wbuf_areas = 0;
|
||||
}
|
||||
free(file->wbuf);
|
||||
free(file->wbuf_areas);
|
||||
file->wbuf = NULL;
|
||||
file->wbuf_areas = NULL;
|
||||
return snd_pcm_hw_free(file->gen.slave);
|
||||
}
|
||||
|
||||
|
|
@ -418,8 +415,7 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
|
|||
|
||||
err = snd_pcm_new(&pcm, SND_PCM_TYPE_FILE, name, slave->stream, slave->mode);
|
||||
if (err < 0) {
|
||||
if (fname)
|
||||
free(file->fname);
|
||||
free(file->fname);
|
||||
free(file);
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -843,10 +843,8 @@ static int snd_pcm_hw_munmap_status(snd_pcm_t *pcm)
|
|||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
int err;
|
||||
if (hw->sync_ptr_ioctl) {
|
||||
if (hw->sync_ptr) {
|
||||
free(hw->sync_ptr);
|
||||
hw->sync_ptr = NULL;
|
||||
}
|
||||
free(hw->sync_ptr);
|
||||
hw->sync_ptr = NULL;
|
||||
} else {
|
||||
if (munmap((void*)hw->mmap_status, page_align(sizeof(*hw->mmap_status))) < 0) {
|
||||
err = -errno;
|
||||
|
|
@ -862,10 +860,8 @@ static int snd_pcm_hw_munmap_control(snd_pcm_t *pcm)
|
|||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
int err;
|
||||
if (hw->sync_ptr_ioctl) {
|
||||
if (hw->sync_ptr) {
|
||||
free(hw->sync_ptr);
|
||||
hw->sync_ptr = NULL;
|
||||
}
|
||||
free(hw->sync_ptr);
|
||||
hw->sync_ptr = NULL;
|
||||
} else {
|
||||
if (munmap(hw->mmap_control, page_align(sizeof(*hw->mmap_control))) < 0) {
|
||||
err = -errno;
|
||||
|
|
|
|||
|
|
@ -175,10 +175,8 @@ static int snd_pcm_ladspa_find_port_idx(unsigned int *res,
|
|||
|
||||
static void snd_pcm_ladspa_free_io(snd_pcm_ladspa_plugin_io_t *io)
|
||||
{
|
||||
if (io->controls)
|
||||
free(io->controls);
|
||||
if (io->controls_initialized)
|
||||
free(io->controls_initialized);
|
||||
free(io->controls);
|
||||
free(io->controls_initialized);
|
||||
}
|
||||
|
||||
static void snd_pcm_ladspa_free_plugins(struct list_head *plugins)
|
||||
|
|
@ -189,8 +187,7 @@ static void snd_pcm_ladspa_free_plugins(struct list_head *plugins)
|
|||
snd_pcm_ladspa_free_io(&plugin->output);
|
||||
if (plugin->dl_handle)
|
||||
dlclose(plugin->dl_handle);
|
||||
if (plugin->filename)
|
||||
free(plugin->filename);
|
||||
free(plugin->filename);
|
||||
list_del(&plugin->list);
|
||||
free(plugin);
|
||||
}
|
||||
|
|
@ -203,8 +200,7 @@ static void snd_pcm_ladspa_free(snd_pcm_ladspa_t *ladspa)
|
|||
snd_pcm_ladspa_free_plugins(&ladspa->pplugins);
|
||||
snd_pcm_ladspa_free_plugins(&ladspa->cplugins);
|
||||
for (idx = 0; idx < 2; idx++) {
|
||||
if (ladspa->zero[idx])
|
||||
free(ladspa->zero[idx]);
|
||||
free(ladspa->zero[idx]);
|
||||
ladspa->zero[idx] = NULL;
|
||||
}
|
||||
ladspa->allocated = 0;
|
||||
|
|
@ -317,10 +313,8 @@ static int snd_pcm_ladspa_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params
|
|||
|
||||
static void snd_pcm_ladspa_free_eps(snd_pcm_ladspa_eps_t *eps)
|
||||
{
|
||||
if (eps->channels.array)
|
||||
free(eps->channels.array);
|
||||
if (eps->ports.array)
|
||||
free(eps->ports.array);
|
||||
free(eps->channels.array);
|
||||
free(eps->ports.array);
|
||||
}
|
||||
|
||||
static void snd_pcm_ladspa_free_instances(snd_pcm_t *pcm, snd_pcm_ladspa_t *ladspa, int cleanup)
|
||||
|
|
@ -340,14 +334,12 @@ static void snd_pcm_ladspa_free_instances(snd_pcm_t *pcm, snd_pcm_ladspa_t *lads
|
|||
plugin->desc->cleanup(instance->handle);
|
||||
if (instance->input.m_data) {
|
||||
for (idx = 0; idx < instance->input.channels.size; idx++)
|
||||
if (instance->input.m_data[idx])
|
||||
free(instance->input.m_data[idx]);
|
||||
free(instance->input.m_data[idx]);
|
||||
free(instance->input.m_data);
|
||||
}
|
||||
if (instance->output.m_data) {
|
||||
for (idx = 0; idx < instance->output.channels.size; idx++)
|
||||
if (instance->output.m_data[idx])
|
||||
free(instance->output.m_data[idx]);
|
||||
free(instance->output.m_data[idx]);
|
||||
free(instance->output.m_data);
|
||||
}
|
||||
list_del(&(instance->list));
|
||||
|
|
@ -789,10 +781,8 @@ static int snd_pcm_ladspa_allocate_memory(snd_pcm_t *pcm, snd_pcm_ladspa_t *lads
|
|||
for (idx = 0; idx < instance->output.channels.size; idx++) {
|
||||
chn = instance->output.channels.array[idx];
|
||||
if (instance->output.data[idx] == pchannels[chn]) {
|
||||
if (instance->output.m_data[idx]) {
|
||||
free(instance->output.m_data[idx]);
|
||||
instance->output.m_data[idx] = NULL;
|
||||
}
|
||||
free(instance->output.m_data[idx]);
|
||||
instance->output.m_data[idx] = NULL;
|
||||
if (chn < ochannels) {
|
||||
instance->output.data[idx] = NULL;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -153,8 +153,7 @@ static int snd_pcm_meter_update_scope(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_scope_remove(snd_pcm_scope_t *scope)
|
||||
{
|
||||
if (scope->name)
|
||||
free((void *)scope->name);
|
||||
free(scope->name);
|
||||
scope->ops->close(scope);
|
||||
list_del(&scope->list);
|
||||
free(scope);
|
||||
|
|
@ -480,12 +479,10 @@ static int snd_pcm_meter_hw_free(snd_pcm_t *pcm)
|
|||
pthread_mutex_unlock(&meter->running_mutex);
|
||||
err = pthread_join(meter->thread, 0);
|
||||
assert(err == 0);
|
||||
if (meter->buf) {
|
||||
free(meter->buf);
|
||||
free(meter->buf_areas);
|
||||
meter->buf = 0;
|
||||
meter->buf_areas = 0;
|
||||
}
|
||||
free(meter->buf);
|
||||
free(meter->buf_areas);
|
||||
meter->buf = NULL;
|
||||
meter->buf_areas = NULL;
|
||||
return snd_pcm_hw_free(meter->gen.slave);
|
||||
}
|
||||
|
||||
|
|
@ -1028,15 +1025,13 @@ static int s16_enable(snd_pcm_scope_t *scope)
|
|||
}
|
||||
s16->buf = malloc(meter->buf_size * 2 * spcm->channels);
|
||||
if (!s16->buf) {
|
||||
if (s16->adpcm_states)
|
||||
free(s16->adpcm_states);
|
||||
free(s16->adpcm_states);
|
||||
return -ENOMEM;
|
||||
}
|
||||
a = calloc(spcm->channels, sizeof(*a));
|
||||
if (!a) {
|
||||
free(s16->buf);
|
||||
if (s16->adpcm_states)
|
||||
free(s16->adpcm_states);
|
||||
free(s16->adpcm_states);
|
||||
return -ENOMEM;
|
||||
}
|
||||
s16->buf_areas = a;
|
||||
|
|
@ -1051,10 +1046,8 @@ static int s16_enable(snd_pcm_scope_t *scope)
|
|||
static void s16_disable(snd_pcm_scope_t *scope)
|
||||
{
|
||||
snd_pcm_scope_s16_t *s16 = scope->private_data;
|
||||
if (s16->adpcm_states) {
|
||||
free(s16->adpcm_states);
|
||||
s16->adpcm_states = NULL;
|
||||
}
|
||||
free(s16->adpcm_states);
|
||||
s16->adpcm_states = NULL;
|
||||
free(s16->buf);
|
||||
s16->buf = NULL;
|
||||
free(s16->buf_areas);
|
||||
|
|
|
|||
|
|
@ -790,7 +790,7 @@ int snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
|
|||
multi->channels = calloc(channels_count, sizeof(*multi->channels));
|
||||
if (!multi->channels) {
|
||||
free(multi->slaves);
|
||||
free(multi->channels);
|
||||
free(multi);
|
||||
return -ENOMEM;
|
||||
}
|
||||
for (i = 0; i < slaves_count; ++i) {
|
||||
|
|
@ -1130,16 +1130,11 @@ _free:
|
|||
}
|
||||
free(slaves_conf);
|
||||
}
|
||||
if (slaves_pcm)
|
||||
free(slaves_pcm);
|
||||
if (slaves_channels)
|
||||
free(slaves_channels);
|
||||
if (channels_sidx)
|
||||
free(channels_sidx);
|
||||
if (channels_schannel)
|
||||
free(channels_schannel);
|
||||
if (slaves_id)
|
||||
free(slaves_id);
|
||||
free(slaves_pcm);
|
||||
free(slaves_channels);
|
||||
free(channels_sidx);
|
||||
free(channels_schannel);
|
||||
free(slaves_id);
|
||||
return err;
|
||||
}
|
||||
#ifndef DOC_HIDDEN
|
||||
|
|
|
|||
|
|
@ -62,8 +62,7 @@ static int snd_pcm_plug_close(snd_pcm_t *pcm)
|
|||
{
|
||||
snd_pcm_plug_t *plug = pcm->private_data;
|
||||
int err, result = 0;
|
||||
if (plug->ttable)
|
||||
free(plug->ttable);
|
||||
free(plug->ttable);
|
||||
assert(plug->gen.slave == plug->req_slave);
|
||||
if (plug->gen.close_slave) {
|
||||
snd_pcm_unlink_hw_ptr(pcm, plug->req_slave);
|
||||
|
|
|
|||
|
|
@ -513,8 +513,7 @@ static int snd_pcm_route_close(snd_pcm_t *pcm)
|
|||
|
||||
if (params->dsts) {
|
||||
for (dst_channel = 0; dst_channel < params->ndsts; ++dst_channel) {
|
||||
if (params->dsts[dst_channel].srcs != NULL)
|
||||
free(params->dsts[dst_channel].srcs);
|
||||
free(params->dsts[dst_channel].srcs);
|
||||
}
|
||||
free(params->dsts);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1689,10 +1689,8 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, const char *name,
|
|||
speriod_time, sbuffer_time,
|
||||
channels, channels_map, stream, mode);
|
||||
_free:
|
||||
if (channels_map)
|
||||
free(channels_map);
|
||||
if (sname)
|
||||
free((char *)sname);
|
||||
free(channels_map);
|
||||
free((char *)sname);
|
||||
return err;
|
||||
}
|
||||
#ifndef DOC_HIDDEN
|
||||
|
|
|
|||
|
|
@ -773,8 +773,7 @@ int snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
|
|||
close(sock);
|
||||
if (ctrl)
|
||||
shmdt(ctrl);
|
||||
if (shm)
|
||||
free(shm);
|
||||
free(shm);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1029,14 +1029,10 @@ int snd_seq_close(snd_seq_t *seq)
|
|||
int err;
|
||||
assert(seq);
|
||||
err = seq->ops->close(seq);
|
||||
if (seq->obuf)
|
||||
free(seq->obuf);
|
||||
if (seq->ibuf)
|
||||
free(seq->ibuf);
|
||||
if (seq->tmpbuf)
|
||||
free(seq->tmpbuf);
|
||||
if (seq->name)
|
||||
free(seq->name);
|
||||
free(seq->obuf);
|
||||
free(seq->ibuf);
|
||||
free(seq->tmpbuf);
|
||||
free(seq->name);
|
||||
free(seq);
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,8 +167,7 @@ int snd_midi_event_new(size_t bufsize, snd_midi_event_t **rdev)
|
|||
void snd_midi_event_free(snd_midi_event_t *dev)
|
||||
{
|
||||
if (dev != NULL) {
|
||||
if (dev->buf)
|
||||
free(dev->buf);
|
||||
free(dev->buf);
|
||||
free(dev);
|
||||
}
|
||||
}
|
||||
|
|
@ -253,8 +252,7 @@ int snd_midi_event_resize_buffer(snd_midi_event_t *dev, size_t bufsize)
|
|||
dev->buf = new_buf;
|
||||
dev->bufsize = bufsize;
|
||||
reset_encode(dev);
|
||||
if (old_buf)
|
||||
free(old_buf);
|
||||
free(old_buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -243,8 +243,7 @@ int snd_timer_close(snd_timer_t *timer)
|
|||
snd_async_del_handler(h);
|
||||
}
|
||||
err = timer->ops->close(timer);
|
||||
if (timer->name)
|
||||
free(timer->name);
|
||||
free(timer->name);
|
||||
free(timer);
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -197,8 +197,7 @@ int snd_timer_query_close(snd_timer_query_t *timer)
|
|||
int err;
|
||||
assert(timer);
|
||||
err = timer->ops->close(timer);
|
||||
if (timer->name)
|
||||
free(timer->name);
|
||||
free(timer->name);
|
||||
free(timer);
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue