<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - alsa: hctl memory leak"
href="https://bugs.freedesktop.org/show_bug.cgi?id=74213">74213</a>
</td>
</tr>
<tr>
<th>CC</th>
<td>lennart@poettering.net
</td>
</tr>
<tr>
<th>Assignee</th>
<td>pulseaudio-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Summary</th>
<td>alsa: hctl memory leak
</td>
</tr>
<tr>
<th>QA Contact</th>
<td>pulseaudio-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Reporter</th>
<td>tanuk@iki.fi
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Component</th>
<td>alsa
</td>
</tr>
<tr>
<th>Product</th>
<td>PulseAudio
</td>
</tr></table>
<p>
<div>
<pre>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().</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>