1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

fuzz-systemctl-parse-argv: call static destuctors

With all the preparatory work in previous PRs, we can now call static destructors
repeatedly without issue. We need to do it here so that global variables allocated
during parsing are properly freed.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-02-16 14:27:26 +01:00
parent 36556f6e51
commit 425ac7a253
2 changed files with 9 additions and 0 deletions

View File

@ -6,6 +6,8 @@
#include "env-util.h"
#include "fd-util.h"
#include "fuzz.h"
#include "selinux-util.h"
#include "static-destruct.h"
#include "stdio-util.h"
#include "strv.h"
#include "systemctl.h"
@ -57,5 +59,12 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
release_busses(); /* We open the bus for communication with logind.
* It needs to be closed to avoid apparent leaks. */
mac_selinux_finish();
/* Call static destructors to do global state cleanup. We do it here, and not in fuzz-main.c so that
* any global state is destoyed between fuzzer runs. */
static_destruct();
return 0;
}