chiark / gitweb /
test-hashmap: fix access to uninitialized memory
[elogind.git] / src / test / test-hashmap.c
index 2aead79bb1d8637b929f2749aaad6234892e72be..2c27d0867047e945cc7a0da585ee643a9975d76b 100644 (file)
@@ -468,9 +468,11 @@ static void test_hashmap_get(void) {
 }
 
 static void test_uint64_compare_func(void) {
-        assert_se(uint64_compare_func("a", "a") == 0);
-        assert_se(uint64_compare_func("a", "b") == -1);
-        assert_se(uint64_compare_func("b", "a") == 1);
+        const uint64_t a = 0x100, b = 0x101;
+
+        assert_se(uint64_compare_func(&a, &a) == 0);
+        assert_se(uint64_compare_func(&a, &b) == -1);
+        assert_se(uint64_compare_func(&b, &a) == 1);
 }
 
 static void test_trivial_compare_func(void) {