mbox series

[0/2] repack: prevent geometry struct leak

Message ID cover.1691613149.git.me@ttaylorr.com (mailing list archive)
Headers show
Series repack: prevent geometry struct leak | expand

Message

Taylor Blau Aug. 9, 2023, 8:32 p.m. UTC
This short series combines a patch from Peff and a patch from me to
prevent leaking the 'struct pack_geometry *' pointer from the repack
code.

The first patch free()s the heap-allocated struct, and the second
patch moves the variable to be allocated on the stack.

Jeff King (1):
  repack: free geometry struct

Taylor Blau (1):
  repack: move `pack_geometry` struct to the stack

 builtin/repack.c | 66 +++++++++++++++++++++++-------------------------
 1 file changed, 32 insertions(+), 34 deletions(-)

Comments

Jeff King Aug. 10, 2023, 12:19 a.m. UTC | #1
On Wed, Aug 09, 2023 at 04:32:36PM -0400, Taylor Blau wrote:

> This short series combines a patch from Peff and a patch from me to
> prevent leaking the 'struct pack_geometry *' pointer from the repack
> code.
> 
> The first patch free()s the heap-allocated struct, and the second
> patch moves the variable to be allocated on the stack.

Thanks for cleaning up your patch. I think Junio has the first one in
'next' already as jk/repack-leakfix, but your patch 2 can go on top.

The result looks good to me. It's a little unusual that the "init"
function expects the caller to have already initialized-to-zero and set
the split_factor field, but I think that's OK for a struct that is
limited to this one file.

-Peff