diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-05-10 01:04:53 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-05-10 01:36:50 +0200 |
commit | db983479afdb0daddcb1cafcd609f4bce23fc993 (patch) | |
tree | 2c0d61b271d03c2f10dae73e7cffb73047a1ebd1 /src/test/test-sleep.c | |
parent | f5ce2e764fdab02e3d28eb653253686cffd71920 (diff) | |
download | systemd-db983479afdb0daddcb1cafcd609f4bce23fc993.tar.gz systemd-db983479afdb0daddcb1cafcd609f4bce23fc993.tar.bz2 systemd-db983479afdb0daddcb1cafcd609f4bce23fc993.zip |
shared/sleep-config: fix memleak of strv, add test
CID #1390921, #1390951.
Diffstat (limited to 'src/test/test-sleep.c')
-rw-r--r-- | src/test/test-sleep.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/test-sleep.c b/src/test/test-sleep.c index c2cb4ef949..1c5b56f4a0 100644 --- a/src/test/test-sleep.c +++ b/src/test/test-sleep.c @@ -14,6 +14,13 @@ #include "strv.h" #include "util.h" +static void test_parse_sleep_config(void) { + const char *verb; + + FOREACH_STRING(verb, "suspend", "hibernate", "hybrid-sleep", "suspend-then-hibernate") + assert_se(parse_sleep_config(verb, NULL, NULL, NULL) == 0); +} + static int test_fiemap(const char *path) { _cleanup_free_ struct fiemap *fiemap = NULL; _cleanup_close_ int fd = -1; @@ -84,6 +91,7 @@ int main(int argc, char* argv[]) { if (getuid() != 0) log_warning("This program is unlikely to work for unprivileged users"); + test_parse_sleep_config(); test_sleep(); if (argc <= 1) |