diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-10-04 06:58:53 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-10-04 07:59:31 -0700 |
commit | 2179b5c831f6bc286acda15c7c7f4a573291ee5c (patch) | |
tree | 7fe65ef52df45cb578e2999aacf9651d42bb6b4a /commit-graph.c | |
parent | 35730302e995337766805299fa1128c1b9d8988c (diff) |
reftable/basics: fix segfault when growing `names` array fails
When growing the `names` array fails we would end up with a `NULL`
pointer. This causes two problems:
- We would run into a segfault because we try to free names that we
have assigned to the array already.
- We lose track of the old array and cannot free its contents.
Fix this issue by using a temporary variable. Like this we do not
clobber the old array that we tried to reallocate, which will remain
valid when a call to realloc(3P) fails.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-graph.c')
0 files changed, 0 insertions, 0 deletions