Skip to content

Commit 60b1c5f

Browse files
committed
tools: plugin: tplg: Fix a couple of memory leaks
Free the memory allocated for tplg base and available input/output formats when the topology is freed. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
1 parent 1470e6c commit 60b1c5f

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

tools/plugin/alsaplug/tplg.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,6 +1445,7 @@ int plug_free_pipelines(snd_sof_plug_t *plug, struct tplg_pipeline_list *pipelin
14451445

14461446
void plug_free_topology(snd_sof_plug_t *plug)
14471447
{
1448+
struct tplg_context *ctx = &plug->tplg;
14481449
struct list_item *item, *_item;
14491450

14501451
list_for_item_safe(item, _item, &plug->pcm_list) {
@@ -1456,7 +1457,10 @@ void plug_free_topology(snd_sof_plug_t *plug)
14561457

14571458
list_for_item_safe(item, _item, &plug->widget_list) {
14581459
struct tplg_comp_info *comp_info = container_of(item, struct tplg_comp_info, item);
1460+
struct sof_ipc4_available_audio_format *available_fmts = &comp_info->available_fmt;
14591461

1462+
free(available_fmts->output_pin_fmts);
1463+
free(available_fmts->input_pin_fmts);
14601464
free(comp_info->name);
14611465
free(comp_info->stream_name);
14621466
free(comp_info->ipc_payload);
@@ -1478,5 +1482,6 @@ void plug_free_topology(snd_sof_plug_t *plug)
14781482
free(pipe_info);
14791483
}
14801484

1485+
free(ctx->tplg_base);
14811486
tplg_debug("freed all pipelines, widgets, routes and pcms\n");
14821487
}

0 commit comments

Comments
 (0)