if (!func_name) {
int len = 16 + strlen(str) + 1;
buf = malloc(len);
+ if (! buf) {
+ err = -ENOMEM;
+ goto _err;
+ }
snprintf(buf, len, "snd_config_hook_%s", str);
buf[len-1] = '\0';
func_name = buf;
if (!func_name) {
int len = 9 + strlen(str) + 1;
buf = malloc(len);
+ if (! buf) {
+ err = -ENOMEM;
+ goto _err;
+ }
snprintf(buf, len, "snd_func_%s", str);
buf[len-1] = '\0';
func_name = buf;
}
assert(!adpcm->states);
adpcm->states = malloc(adpcm->plug.slave->channels * sizeof(*adpcm->states));
+ if (adpcm->states == NULL)
+ return -ENOMEM;
return 0;
}
return -EINVAL;
}
dmix->bindings = malloc(count * sizeof(unsigned int));
+ if (dmix->bindings == NULL)
+ return -ENOMEM;
for (chn = 0; chn < count; chn++)
dmix->bindings[chn] = UINT_MAX; /* don't route */
snd_config_for_each(i, next, cfg) {
}
filename = malloc(len + strlen(dirent->d_name) + 1 + need_slash);
+ if (filename == NULL)
+ return -ENOMEM;
strcpy(filename, path);
if (need_slash)
strcat(filename, "/");
}
if (count > 0) {
array = (unsigned int *)calloc(count, sizeof(unsigned int));
+ if (! array)
+ return -ENOMEM;
memset(array, 0xff, count * sizeof(unsigned int));
io->port_bindings_size = count;
io->port_bindings = array;
if ((lplug->desc->PortDescriptors[idx] & (io->pdesc | LADSPA_PORT_CONTROL)) == (io->pdesc | LADSPA_PORT_CONTROL))
count++;
array = (LADSPA_Data *)calloc(count, sizeof(LADSPA_Data));
+ if (!array)
+ return -ENOMEM;
io->controls_size = count;
io->controls = array;
snd_config_for_each(i, next, controls) {
multi->slaves_count = slaves_count;
multi->master_slave = master_slave;
multi->slaves = calloc(slaves_count, sizeof(*multi->slaves));
+ if (!multi->slaves) {
+ free(multi);
+ return -ENOMEM;
+ }
multi->channels_count = channels_count;
multi->channels = calloc(channels_count, sizeof(*multi->channels));
+ if (!multi->channels) {
+ free(multi->slaves);
+ free(multi->channels);
+ return -ENOMEM;
+ }
for (i = 0; i < slaves_count; ++i) {
snd_pcm_multi_slave_t *slave = &multi->slaves[i];
assert(slaves_pcm[i]->stream == stream);
slaves_channels = calloc(slaves_count, sizeof(*slaves_channels));
channels_sidx = calloc(channels_count, sizeof(*channels_sidx));
channels_schannel = calloc(channels_count, sizeof(*channels_schannel));
+ if (!slaves_id || !slaves_conf || !slaves_pcm || !slaves_channels ||
+ !channels_sidx || !channels_schannel) {
+ err = -ENOMEM;
+ goto _free;
+ }
idx = 0;
for (idx = 0; idx < channels_count; ++idx)
channels_sidx[idx] = -1;
free(channels_sidx);
if (channels_schannel)
free(channels_schannel);
+ if (slaves_id)
+ free(slaves_id);
return err;
}
#ifndef DOC_HIDDEN
goto _free;
}
channels_map = calloc(channels, sizeof(*channels_map));
+ if (! channels_map) {
+ err = -ENOMEM;
+ goto _free;
+ }
snd_config_for_each(i, next, bindings) {
snd_config_t *n = snd_config_iterator_entry(i);
conf.ifc_len = numreqs * sizeof(struct ifreq);
conf.ifc_buf = malloc((unsigned int) conf.ifc_len);
+ if (! conf.ifc_buf)
+ return -ENOMEM;
while (1) {
err = ioctl(s, SIOCGIFCONF, &conf);
if (err < 0) {
numreqs *= 2;
conf.ifc_len = numreqs * sizeof(struct ifreq);
conf.ifc_buf = realloc(conf.ifc_buf, (unsigned int) conf.ifc_len);
+ if (! conf.ifc_buf)
+ return -ENOMEM;
}
numreqs = conf.ifc_len / sizeof(struct ifreq);
for (i = 0; i < numreqs; ++i) {