diff options
| author | Taylor Blau <me@ttaylorr.com> | 2024-05-14 15:57:03 -0400 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-05-15 06:52:32 -0700 |
| commit | f25e1f2a4d48c6d8bfd659338d4415c7ef4df533 (patch) | |
| tree | fd7bcd2dad3c066a635b0bad04c74d48ad4bed02 /t/helper/test-regex.c | |
| parent | 9675b0691732d5475a353a69c3a8e14804b22a64 (diff) | |
pack-bitmap-write.c: avoid uninitialized 'write_as' field
Prepare to free() memory associated with bitmapped_commit structs by
zero'ing the 'write_as' field.
In ideal cases, it is fine to do something like:
for (i = 0; i < writer->selected_nr; i++) {
struct bitmapped_commit *bc = &writer->selected[i];
if (bc->write_as != bc->bitmap)
ewah_free(bc->write_as);
ewah_free(bc->bitmap);
}
but if not all of the 'write_as' fields were populated (e.g., because
the packing_data given does not form a reachability closure), then we
may attempt to free uninitialized memory.
Guard against this by preemptively zero'ing this field just in case.
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/helper/test-regex.c')
0 files changed, 0 insertions, 0 deletions
