[PATCH 09/11] submodule--helper: free "char *" in "struct update_data"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make the update_data_release() function free the "recursive_prefix"
and "displaypath" members when appropriate. For the former it could
come from either "argv" or from our own allocation, so we need to keep
track of a "to_free" sibling seperately.

For "displaypath" it's always ours, so the "const char *" type was
wrong to begin with, it should be a "char *" instead.

For update_submodule() we'll free() these as we go along, it's called
in a loop by update_submodules(), and we'll need to free the "last"
one.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
---
 builtin/submodule--helper.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 2b44f391f15..0bac39880d2 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1949,7 +1949,7 @@ static void submodule_update_clone_release(struct submodule_update_clone *suc)
 
 struct update_data {
 	const char *prefix;
-	const char *displaypath;
+	char *displaypath;
 	enum submodule_update_type update_default;
 	struct object_id suboid;
 	struct string_list references;
@@ -1987,6 +1987,7 @@ struct update_data {
 
 static void update_data_release(struct update_data *ud)
 {
+	free(ud->displaypath);
 	module_list_release(&ud->list);
 }
 
-- 
2.37.0.932.g7b7031e73bc




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux