[pulseaudio-tickets] [Bug 74213] New: alsa: hctl memory leak

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Jan 30 01:14:12 PST 2014


https://bugs.freedesktop.org/show_bug.cgi?id=74213

          Priority: medium
            Bug ID: 74213
                CC: lennart at poettering.net
          Assignee: pulseaudio-bugs at lists.freedesktop.org
           Summary: alsa: hctl memory leak
        QA Contact: pulseaudio-bugs at lists.freedesktop.org
          Severity: normal
    Classification: Unclassified
                OS: All
          Reporter: tanuk at iki.fi
          Hardware: Other
            Status: NEW
           Version: unspecified
         Component: alsa
           Product: PulseAudio

Valgrind reports a memory leak in alsa-lib (but this may also be a PulseAudio
bug):

==8634== HEAP SUMMARY:
==8634==     in use at exit: 52,492 bytes in 461 blocks
==8634==   total heap usage: 39,922 allocs, 39,461 frees, 5,539,674 bytes
allocated
==8634== 
==8634== 80 bytes in 5 blocks are definitely lost in loss record 55 of 92
==8634==    at 0x4A06409: malloc (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==8634==    by 0x37596463BD: ??? (in /usr/lib64/libasound.so.2.0.0)
==8634==    by 0x3759646549: ??? (in /usr/lib64/libasound.so.2.0.0)
==8634==    by 0x375963C11C: snd_hctl_load (in /usr/lib64/libasound.so.2.0.0)
==8634==    by 0x37596470D8: snd_mixer_load (in /usr/lib64/libasound.so.2.0.0)
==8634==    by 0xD60B306: prepare_mixer (alsa-util.c:1506)
==8634==    by 0xD60B474: pa_alsa_open_mixer (alsa-util.c:1529)
==8634==    by 0xDC5968A: init_jacks (module-alsa-card.c:503)
==8634==    by 0xDC5A588: module_alsa_card_LTX_pa__init
(module-alsa-card.c:754)
==8634==    by 0x1017998A: pa_module_load (module.c:174)
==8634==    by 0xE691E33: verify_access (module-udev-detect.c:341)
==8634==    by 0xE692393: card_changed (module-udev-detect.c:430)
==8634== 
==8634== LEAK SUMMARY:
==8634==    definitely lost: 80 bytes in 5 blocks
==8634==    indirectly lost: 0 bytes in 0 blocks
==8634==      possibly lost: 0 bytes in 0 blocks
==8634==    still reachable: 52,412 bytes in 456 blocks
==8634==         suppressed: 0 bytes in 0 blocks

This may be a PulseAudio bug too, I'm not sure. The reason why I think
it's an alsa-lib bug is this comment in prepare_mixer():

    /* Note: The hctl handle returned should not be freed.
       It is closed/freed by alsa-lib on snd_mixer_close/free */
    if (hctl && (err = snd_mixer_get_hctl(mixer, dev, hctl)) < 0) {
        pa_log_info("Unable to get hctl of mixer %s: %s", dev,
pa_alsa_strerror(err));
        return -1;
    }

As far as I can tell, we close all mixer handles when we don't need them
anymore, so based on that comment, all hctl resources should get
released too. But maybe the comment is wrong or I don't understand it
correctly. I don't know the relationships between snd_mixer_open(),
snd_mixer_load(), snd_mixer_close() and snd_mixer_free(). We call both
snd_mixer_open() and snd_mixer_load(), but we never call
snd_mixer_free().

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-bugs/attachments/20140130/e74e53ee/attachment.html>


More information about the pulseaudio-bugs mailing list