revision: fix leaking display notes
We never free the display notes options embedded into `struct revision`. Implement a new function `release_display_notes()` that we can call in `release_revisions()` to fix this. There is another gotcha here though: we play some games with the string list used to track extra notes refs, where we sometimes set the bit that indicates that strings should be strdup'd and sometimes unset it. This dance is done to avoid a copy of an already-allocated string when we call `enable_ref_display_notes()`. But this dance is rather pointless as we can instead call `string_list_append_nodup()` to transfer ownership of the allocated string to the list. Refactor the code to do so and drop the `strdup_strings` dance. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
3d31d38255
commit
9748537437
5
notes.h
5
notes.h
@ -275,6 +275,11 @@ struct display_notes_opt {
|
||||
*/
|
||||
void init_display_notes(struct display_notes_opt *opt);
|
||||
|
||||
/*
|
||||
* Release resources acquired by the display_notes_opt.
|
||||
*/
|
||||
void release_display_notes(struct display_notes_opt *opt);
|
||||
|
||||
/*
|
||||
* This family of functions enables or disables the display of notes. In
|
||||
* particular, 'enable_default_display_notes' will display the default notes,
|
||||
|
Reference in New Issue
Block a user