"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
Re: plug line_offsets leak in tog blame
To:
Mark Jamsek <mark@jamsek.com>
Cc:
gameoftrees@openbsd.org
Date:
Sun, 13 Aug 2023 11:40:14 +0200

Download raw body.

Thread
On 2023/08/11 20:30:52 +1000, Mark Jamsek <mark@jamsek.com> wrote:
> As per the subject, we are leaking the blamed file's line_offsets
> allocated from run_blame()'s call to got_object_blob_dump_to_file().
> 
> We need to free them from stop_blame() and not close_blame_view()
> because we reload the blame view without closing it (e.g., cCp keymaps)
> and only call stop_blame() in such cases.

ok op@

> diff 2e76d8a7c48df35fbab843656f1c604c999ed71f 24ddc342dc6398b32e9ce3d5cbcdc2b331228747
> commit - 2e76d8a7c48df35fbab843656f1c604c999ed71f
> commit + 24ddc342dc6398b32e9ce3d5cbcdc2b331228747
> blob - c4839d1c9023a068753142f189620d39826b0968
> blob + d0f674078d9fb63ad070889a2c85507fd302daf3
> --- tog/tog.c
> +++ tog/tog.c
> @@ -6590,6 +6590,8 @@ stop_blame(struct tog_blame *blame)
>  			err = pack_err;
>  		blame->pack_fds = NULL;
>  	}
> +	free(blame->line_offsets);
> +	blame->line_offsets = NULL;
>  	return err;
>  }
>