summaryrefslogtreecommitdiff
path: root/src/systemctl/fuzz-systemctl-parse-argv.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-02-16 14:27:26 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-02-16 17:15:11 +0100
commit425ac7a253321b8e8d1b0a0f7a173892a3abc385 (patch)
treeb868f499f1f45ee021c4a446e3fc50de3ad3a4c4 /src/systemctl/fuzz-systemctl-parse-argv.c
parent36556f6e514095d220d1cdb37697a07f4b6061d3 (diff)
downloadsystemd-425ac7a253321b8e8d1b0a0f7a173892a3abc385.tar.gz
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.
Diffstat (limited to 'src/systemctl/fuzz-systemctl-parse-argv.c')
-rw-r--r--src/systemctl/fuzz-systemctl-parse-argv.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/systemctl/fuzz-systemctl-parse-argv.c b/src/systemctl/fuzz-systemctl-parse-argv.c
index cf66fa4bb7..31269863c1 100644
--- a/src/systemctl/fuzz-systemctl-parse-argv.c
+++ b/src/systemctl/fuzz-systemctl-parse-argv.c
@@ -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;
}