From: Stefan Sperling Subject: Re: tog: fix NULL pointer deref segv with log view T keymap To: Mark Jamsek Cc: gameoftrees@openbsd.org Date: Mon, 30 Dec 2024 10:22:52 +0100 On Mon, Dec 30, 2024 at 04:11:06PM +1100, Mark Jamsek wrote: > Stefan Sperling wrote: > > On Mon, Dec 30, 2024 at 03:50:37AM +1100, Mark Jamsek wrote: > > > And here's the actual updated diff; sorry for the noise! > > > > ok by me > > Thanks, stsp! I've realised a problem with the diff in the error case: > it leaks tree_view's member objects because free(tree_view) is wrong, > we need to call view_close(tree_view). > > Also, open_tree_view() already calls view_close() (and close_tree_view() > if tree_view's close() function pointer has not already been assigned) > in all of its error paths, which simplifies things a fair bit and makes > for a much nicer fix. Indeed. ok again. I've briefly tested this diff as well and it fixes the segfault as expected.