[alsa-devel] [PATCH 3/6] topology: Use generic pointer to realloc buffer for private data
Jaroslav Kysela
perex at perex.cz
Thu Apr 28 10:48:36 CEST 2016
Dne 28.4.2016 v 10:41 mengdong.lin at linux.intel.com napsal(a):
> priv_data_size = ref->data->size;
> + elem->obj = realloc(elem->obj,
> + elem->size + priv_data_size);
> + if (!elem->obj)
> + return -ENOMEM;
This causes a memory leak when realloc fails. You should free the
original pointer when realloc() fails.
Jaroslav
--
Jaroslav Kysela <perex at perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
More information about the Alsa-devel
mailing list