git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] reftable: fix realloc error handling
@ 2024-12-25 18:33 René Scharfe
  2024-12-25 18:38 ` [PATCH 1/4] reftable: avoid leaks on realloc error René Scharfe
                   ` (5 more replies)
  0 siblings, 6 replies; 25+ messages in thread
From: René Scharfe @ 2024-12-25 18:33 UTC (permalink / raw)
  To: Git List; +Cc: Patrick Steinhardt

The current handling of reallocation errors leaks the original
allocation in most cases and corrupts the capacity variable.  Fix
that in REFTABLE_ALLOC_GROW and by providing a new macro
REFTABLE_ALLOC_GROW_OR_NULL -- solve this somewhat tricky issue
centrally, with minimal impact to calling code.

And the last two patches add error handling to the remaining
places that still lack it.

  reftable: avoid leaks on realloc error
  reftable: fix allocation count on realloc error
  reftable: handle realloc error in parse_names()
  t-reftable-merged: handle realloc errors

 reftable/basics.c                | 14 ++++-------
 reftable/basics.h                | 41 +++++++++++++++++++++++++-------
 reftable/block.c                 | 10 ++++----
 reftable/pq.c                    |  2 +-
 reftable/record.c                | 12 +++++-----
 reftable/stack.c                 |  8 ++++---
 reftable/writer.c                |  5 ++--
 t/unit-tests/t-reftable-merged.c |  4 ++--
 8 files changed, 60 insertions(+), 36 deletions(-)

--
2.47.1


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2024-12-30  7:25 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-25 18:33 [PATCH 0/4] reftable: fix realloc error handling René Scharfe
2024-12-25 18:38 ` [PATCH 1/4] reftable: avoid leaks on realloc error René Scharfe
2024-12-27  5:39   ` Junio C Hamano
2024-12-27 10:33   ` Patrick Steinhardt
2024-12-27 20:16     ` René Scharfe
2024-12-30  6:29       ` Patrick Steinhardt
2024-12-25 18:38 ` [PATCH 2/4] reftable: fix allocation count " René Scharfe
2024-12-27 10:33   ` Patrick Steinhardt
2024-12-27 20:16     ` René Scharfe
2024-12-27 20:16   ` René Scharfe
2024-12-25 18:38 ` [PATCH 3/4] reftable: handle realloc error in parse_names() René Scharfe
2024-12-25 18:38 ` [PATCH 4/4] t-reftable-merged: check realloc errors René Scharfe
2024-12-27  5:46   ` Junio C Hamano
2024-12-27 10:34     ` Patrick Steinhardt
2024-12-27 20:16       ` René Scharfe
2024-12-27 10:34 ` [PATCH 0/4] reftable: fix realloc error handling Patrick Steinhardt
2024-12-27 16:02   ` Junio C Hamano
2024-12-28  9:43 ` [PATCH v2 " René Scharfe
2024-12-28  9:47   ` [PATCH v2 1/4] reftable: avoid leaks on realloc error René Scharfe
2024-12-30  7:25     ` Patrick Steinhardt
2024-12-28  9:48   ` [PATCH v2 2/4] reftable: fix allocation count " René Scharfe
2024-12-28  9:48   ` [PATCH v2 3/4] reftable: handle realloc error in parse_names() René Scharfe
2024-12-30  7:25     ` Patrick Steinhardt
2024-12-28  9:49   ` [PATCH v2 4/4] t-reftable-merged: handle realloc errors René Scharfe
2024-12-30  7:25   ` [PATCH v2 0/4] reftable: fix realloc error handling Patrick Steinhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).