On Sat, Apr 6, 2024 at 9:07 PM Jeff King <peff@xxxxxxxx> wrote: > We feed items into ignore_revs_file_list in two ways: from config and > from the command-line. Items from the command-line point to argv entries > that we don't own, but items from config are hea-allocated strings whose > ownership is handed to the string list when we insert them. s/hea/heap/ > Because the string_list is declared with "NODUP", our string_list_clear() > call will not free the entries themselves. This is the right thing for > the argv entries, but means that we leak the allocated config entries. > > Let's declare the string list as owning its own strings, which means > that the argv entries will be copied. > > For the config entries we would ideally use string_list_append_nodup() > to just hand off ownership of our strings. But we insert them into the > sorted list with string_list_insert(), which doesn't have a nodup > variant. Since this isn't a hot path, we can accept that the path > interpolation will produce a temporary string which is then freed. > > Signed-off-by: Jeff King <peff@xxxxxxxx>