free() can handle NULL just fine so skip the check

Fixes #117
This commit is contained in:
Wim Taymans 2018-12-19 17:47:25 +01:00
parent b6db6e2130
commit 0984096089
13 changed files with 63 additions and 99 deletions

View file

@ -625,8 +625,7 @@ static int negotiate_buffers(struct impl *impl)
spa_buffer_alloc_fill_info(&info, 0, NULL, blocks, datas, aligns);
info.skel_size = SPA_ROUND_UP_N(info.skel_size, 16);
if (impl->buffers)
free(impl->buffers);
free(impl->buffers);
impl->buffers = calloc(buffers, sizeof(struct spa_buffer *) + info.skel_size);
if (impl->buffers == NULL)
return -ENOMEM;
@ -1111,12 +1110,9 @@ static void cleanup(struct impl *impl)
pw_unload_spa_interface(impl->adapter);
}
if (impl->buffers)
free(impl->buffers);
if (impl->mem) {
free(impl->buffers);
if (impl->mem)
pw_memblock_free(impl->mem);
impl->mem = NULL;
}
free(impl);
}