-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
unpack-trees.[ch]: embed "dir" in "struct unpack_trees_options"
Change the "struct dir" in "struct unpack_trees_options" away from a pointer to being embedded in the struct itself, this mean that we can initialize it with our new UNPACK_TREES_OPTIONS_INIT macro. As it turned out nothing actually needed to provide its own "struct dir" to this API, there's another patch to "hide" the struct instead, see the discussion at [1], but I think just allocating it on the stack along with the rest makes more sense. This fixes a memory leak in "builtin/checkout.c" that's been there since the clear_unpack_trees_porcelain() function was added in 1c41d28 (unpack_trees_options: free messages when done, 2018-05-21), i.e. we still had a memory leak from allocating the "dir" member here. That "dir" member had in turn been with us ever since 782c2d6 (Build in checkout, 2008-02-07). This fixes that memory leak, and allows us to remove the boilerplate dir_clear() elsewhere in favor of just using clear_unpack_trees_porcelain(). 1. https://lore.kernel.org/git/87ilyjviiy.fsf@evledraar.gmail.com/ Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Loading branch information
Showing
6 changed files
with
20 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters