1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

test: fix potential use-after-free

CID#1428676.
This commit is contained in:
Frantisek Sumsal 2020-05-02 15:18:35 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent 80cf50120c
commit 111e71c431

View File

@ -388,7 +388,7 @@ static void test_cg_get_keyed_attribute(void) {
assert_se(val == NULL);
assert_se(cg_get_keyed_attribute("cpu", "/init.scope", "cpu.stat", STRV_MAKE("usage_usec"), &val) == 0);
free(val);
val = mfree(val);
assert_se(cg_get_keyed_attribute_graceful("cpu", "/init.scope", "cpu.stat", STRV_MAKE("usage_usec"), &val) == 1);
log_info("cpu /init.scope cpu.stat [usage_usec] → \"%s\"", val);