summaryrefslogtreecommitdiffstats
path: root/src/test/test-unit-name.c
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2020-07-06 15:22:28 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-07-06 17:13:37 +0200
commit9a61e8fca216f27ab26c490cfaac03f77028b174 (patch)
tree4aafe4bf8913bd0635777dd2efb67bb1747627b2 /src/test/test-unit-name.c
parentMerge pull request #16370 from keszybz/tree-wide-spelling (diff)
downloadsystemd-9a61e8fca216f27ab26c490cfaac03f77028b174.tar.xz
systemd-9a61e8fca216f27ab26c490cfaac03f77028b174.zip
unit-name: fix a potential memory leak
Also, add a test which verifies the issue is indeed gone. Fixes: CID#1429014 Followup to: ab19db01ae1826efb3cbdf6dcb6a14412f8844d4
Diffstat (limited to 'src/test/test-unit-name.c')
-rw-r--r--src/test/test-unit-name.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/test/test-unit-name.c b/src/test/test-unit-name.c
index 6e294c72d6..0d524f9a56 100644
--- a/src/test/test-unit-name.c
+++ b/src/test/test-unit-name.c
@@ -130,6 +130,7 @@ static void test_unit_name_from_path(void) {
test_unit_name_from_path_one("///", ".mount", "-.mount", 0);
test_unit_name_from_path_one("/foo/../bar", ".mount", NULL, -EINVAL);
test_unit_name_from_path_one("/foo/./bar", ".mount", NULL, -EINVAL);
+ test_unit_name_from_path_one("/waldoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", ".mount", NULL, -EINVAL);
}
static void test_unit_name_from_path_instance_one(const char *pattern, const char *path, const char *suffix, const char *expected, int ret) {
@@ -159,6 +160,7 @@ static void test_unit_name_from_path_instance(void) {
test_unit_name_from_path_instance_one("waldo", "..", ".mount", NULL, -EINVAL);
test_unit_name_from_path_instance_one("waldo", "/foo", ".waldi", NULL, -EINVAL);
test_unit_name_from_path_instance_one("wa--ldo", "/--", ".mount", "wa--ldo@\\x2d\\x2d.mount", 0);
+ test_unit_name_from_path_instance_one("waldoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "/waldo", ".mount", NULL, -EINVAL);
}
static void test_unit_name_to_path_one(const char *unit, const char *path, int ret) {