topology: Define a free handler for the element

This handler is defined for type-specific destruction of an element.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Mengdong Lin 2016-04-07 15:29:01 +08:00 committed by Takashi Iwai
parent 374c5fa9c5
commit 6b31bf8edb
2 changed files with 7 additions and 1 deletions

View file

@ -83,8 +83,12 @@ void tplg_elem_free(struct tplg_elem *elem)
/* free struct snd_tplg_ object,
* the union pointers share the same address
*/
if (elem->obj)
if (elem->obj) {
if (elem->free)
elem->free(elem->obj);
free(elem->obj);
}
free(elem);
}