From: Nadav Har'El <[email protected]> Committer: Nadav Har'El <[email protected]> Branch: master
zfs: fix dangling pointer Gcc 14 finds a "dangling pointer" error in the ZFS code. Fix it the same way that the openzfs developers fixed it in https://github.com/openzfs/zfs/commit/4840f023afae7c4932c903cf3a436c02c6704e20 Signed-off-by: Nadav Har'El <[email protected]> --- diff --git a/bsd/cddl/contrib/opensolaris/lib/libuutil/common/uu_list.c b/bsd/cddl/contrib/opensolaris/lib/libuutil/common/uu_list.c --- a/bsd/cddl/contrib/opensolaris/lib/libuutil/common/uu_list.c +++ b/bsd/cddl/contrib/opensolaris/lib/libuutil/common/uu_list.c @@ -507,14 +507,20 @@ uu_list_walk(uu_list_t *lp, uu_walk_fn_t *func, void *private, uint32_t flags) } if (lp->ul_debug || robust) { - uu_list_walk_t my_walk; + uu_list_walk_t *my_walk; void *e; - list_walk_init(&my_walk, lp, flags); + my_walk = uu_zalloc(sizeof (*my_walk)); + if (my_walk == NULL) + return -1; + + list_walk_init(my_walk, lp, flags); while (status == UU_WALK_NEXT && - (e = uu_list_walk_next(&my_walk)) != NULL) + (e = uu_list_walk_next(my_walk)) != NULL) status = (*func)(e, private); - list_walk_fini(&my_walk); + list_walk_fini(my_walk); + + uu_free(my_walk); } else { if (!reverse) { for (np = lp->ul_null_node.uln_next; -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/0000000000001031e4061bf46a1a%40google.com.
