librc: fix double-free

'services' is still referenced by the list
which gets returned. We can't free it.

Thanks to GCC 11's -fanalyzer.

Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Sam James 2022-03-31 07:10:27 +01:00 committed by William Hubbs
parent fbefd68b2d
commit c4f8b1559c

View File

@ -1009,7 +1009,6 @@ rc_services_in_state(RC_SERVICE state)
services = ls_dir(dir, LS_INITD);
if (services) {
TAILQ_CONCAT(list, services, entries);
free(services);
}
}
rc_stringlist_free(dirs);