Package: heimdal-kcm
Version: 7.8.git20221117.28daf24+dfsg-2
Control: found -1 7.7.0+dfsg-2+deb11u3
Control: found -1 7.8.git20221117.28daf24+dfsg-9+deb13u1

In lib/ipc/server.c in there is a memory leak for the c->inmsg allocation in handle_read(). This affects kcm (and probably other servers using this library, but I haven't tested that.) For every request sent to KCM a few bytes are leaked.

This has been fixed upstream on the master branch, but not on
heimdal-7-1-branch:
https://github.com/heimdal/heimdal/pull/983
https://github.com/heimdal/heimdal/commit/5dd29ecd2cc794144de059014a5cbc9c92c3d8bb

As this will cause the kcm process to leak memory until it is killed by the OOM killer, it would be useful to have the fix backported to stable, and if possible oldstable and oldoldstable.

Steps to reproduce:
- Compile heimdal to get debug symbols for kcm
- Run: valgrind --leak-check=full kcm/.libs/kcm
- Run (in another terminal): for i in $(seq 1 1000); do klist -A; done
The result will show something like:
[...]
==144405== 1,031,168 bytes in 1,007 blocks are definitely lost in loss record 40 of 40
==144405==    at 0x48406C4: malloc (vg_replace_malloc.c:380)
==144405== by 0x494CE18: rk_erealloc (in /usr/lib/x86_64-linux-gnu/libroken.so.19.0.0)
==144405==    by 0x113887: handle_read (server.c:877)
==144405==    by 0x113887: process_loop (server.c:1013)
==144405==    by 0x113887: heim_ipc_main (server.c:1184)
==144405==    by 0x10CAAC: main (main.c:103)
==144405==
==144405== LEAK SUMMARY:
==144405==    definitely lost: 1,031,176 bytes in 1,008 blocks
==144405==    indirectly lost: 0 bytes in 0 blocks
==144405==      possibly lost: 437 bytes in 6 blocks
==144405==    still reachable: 3,949 bytes in 139 blocks
==144405==         suppressed: 0 bytes in 0 blocks
[...]

Reply via email to