]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/basic/hashmap.h
shared/unit-file: make sure the old hashmaps and sets are freed upon replacement
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 28 May 2020 12:58:35 +0000 (14:58 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 28 May 2020 16:51:52 +0000 (18:51 +0200)
commit3fb2326f3ed87aa0b26078d307ebfb299e36286d
tree4cd4f128c538bcf701d141c402c39cb71d4a66c7
parentdb868d45f9a50a63a03231e0f475baebd87dab82
shared/unit-file: make sure the old hashmaps and sets are freed upon replacement

Possibly fixes #15220. (There might be another leak. I'm still investigating.)

The leak would occur when the path cache was rebuilt. So in normal circumstances
it wouldn't be too bad, since usually the path cache is not rebuilt too often. But
the case in #15220, where new unit files are created in a loop and started, the leak
occurs once for each unit file:

$ for i in {1..300}; do cp ~/.config/systemd/user/test0001.service ~/.config/systemd/user/test$(printf %04d $i).service; systemctl --user start test$(printf %04d $i).service;done
src/basic/hash-funcs.c
src/basic/hash-funcs.h
src/basic/hashmap.h
src/basic/set.h
src/core/manager.c
src/shared/unit-file.c