mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-04 13:30:08 -05:00
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:
parent
374c5fa9c5
commit
6b31bf8edb
2 changed files with 7 additions and 1 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,6 +127,8 @@ struct tplg_elem {
|
|||
*/
|
||||
struct list_head ref_list;
|
||||
struct list_head list; /* list of all elements with same type */
|
||||
|
||||
void (*free)(void *obj);
|
||||
};
|
||||
|
||||
struct map_elem {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue