diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2020-07-06 15:22:28 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-07-06 17:13:37 +0200 |
commit | 9a61e8fca216f27ab26c490cfaac03f77028b174 (patch) | |
tree | 4aafe4bf8913bd0635777dd2efb67bb1747627b2 /src/test/test-unit-name.c | |
parent | Merge pull request #16370 from keszybz/tree-wide-spelling (diff) | |
download | systemd-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.c | 2 |
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) { |