avoid some leaks and NULL pointer derefs

This commit is contained in:
Wim Taymans 2020-06-08 11:15:53 +02:00
parent 2fd64f1591
commit dac60d4e5b
3 changed files with 8 additions and 1 deletions

View file

@ -189,6 +189,9 @@ setup_props(struct pw_context *context, struct spa_node *spa_node, struct pw_pro
if ((prop = spa_pod_find_prop(props, prop, type))) {
const char *value = pw_properties_get(pw_props, key);
if (value == NULL)
continue;
pw_log_debug("configure prop %s to %s", key, value);
switch(prop->value.type) {

View file

@ -132,8 +132,10 @@ static int alloc_buffers(struct pw_mempool *pool,
PW_MEMBLOCK_FLAG_MAP,
SPA_DATA_MemFd,
n_buffers * info.mem_size);
if (m == NULL)
if (m == NULL) {
free(buffers);
return -errno;
}
data = m->map->ptr;
} else {

View file

@ -181,6 +181,8 @@ pw_properties_new_string(const char *str)
if (eq && eq != val) {
*eq = '\0';
add_func(&impl->this, val, strdup(eq+1));
} else {
free(val);
}
s = pw_split_walk(str, " \t\n\r", &len, &state);
}