]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: fix potential use-after-free
authorFrantisek Sumsal <frantisek@sumsal.cz>
Sat, 2 May 2020 13:18:35 +0000 (15:18 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 4 May 2020 15:10:18 +0000 (17:10 +0200)
CID#1428676.

src/test/test-cgroup-util.c

index 5826d6ec283afba432b2dc31acf9e02754ae5a1f..ea47f5affaba4fe0b99ea3e6f158313771087982 100644 (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);