Skip to content

spa: alsa: acp: fix memleak when destroying card profles

Julian Bouzas requested to merge julian/pipewire:alsa-acp-memleak-fixes into master

This MR fixes a memory leak that happens when destroying alsa card profiles, which currently does not free all the allocated memory. This can be checked running pipewire-media-session / wireplumber with valgrind:

14,752 (200 direct, 14,552 indirect) bytes in 1 blocks are definitely lost in loss record 2,946 of 2,952
    at 0x48435FF: calloc (vg_replace_malloc.c:1117)
    by 0x8BA72B3: ucm_create_profile (alsa-ucm.c:1748)
    by 0x8BA72B3: pa_alsa_ucm_add_profile_set (alsa-ucm.c:2051)
    by 0x8B89B20: acp_card_new (acp.c:1545)
    by 0x8B43CD1: impl_init (alsa-acp-device.c:990)
    by 0x4AC6F65: pw_load_spa_handle (pipewire.c:281)
    by 0x4A9AD77: pw_context_load_spa_handle (context.c:1217)

With this patch, the leak is not shown in valgrind anymore.

Merge request reports