static void test_mnt_id(void) {
_cleanup_fclose_ FILE *f = NULL;
- Hashmap *h;
+ _cleanup_hashmap_free_free_ Hashmap *h = NULL;
Iterator i;
char *p;
void *k;
assert_se(r > 0);
assert_se(sscanf(line, "%i %*s %*s %*s %ms", &mnt_id, &path) == 2);
-
+#if HAS_FEATURE_MEMORY_SANITIZER
+ /* We don't know the length of the string, so we need to unpoison it one char at a time */
+ for (const char *c = path; ;c++) {
+ msan_unpoison(c, 1);
+ if (!*c)
+ break;
+ }
+#endif
log_debug("mountinfo: %s → %i", path, mnt_id);
assert_se(hashmap_put(h, INT_TO_PTR(mnt_id), path) >= 0);
log_debug("the other path for mnt id %i is %s\n", mnt_id2, t);
assert_se(path_equal(p, t));
}
-
- hashmap_free_free(h);
}
static void test_path_is_mount_point(void) {