Re: [PATCH v8 5/6] branch: add --recurse-submodules option for branch creation

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

 



I tested this series some more and found a silly bug.
Let me know if I should just send v9 instead.

----- >8 --------- >8 --------- >8 --------- >8 --------- >8 ----

Subject: [PATCH] submodule-config.c: remove accidental pointer reuse

List entries allocated by traverse_tree_submodules() are sharing the
.name_entry pointer, but each of them needs their own pointer. Fix this.

Signed-off-by: Glen Choo <chooglen@xxxxxxxxxx>
---
 submodule-config.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/submodule-config.c b/submodule-config.c
index 24b8d1a700..c9f54bc72d 100644
--- a/submodule-config.c
+++ b/submodule-config.c
@@ -757,7 +757,8 @@ static void traverse_tree_submodules(struct repository *r,
 		if (S_ISGITLINK(name_entry->mode) &&
 		    is_tree_submodule_active(r, root_tree, tree_path)) {
 			st_entry = xmalloc(sizeof(*st_entry));
-			st_entry->name_entry = name_entry;
+			st_entry->name_entry = xmalloc(sizeof(*st_entry->name_entry));
+			*st_entry->name_entry = *name_entry;
 			st_entry->submodule =
 				submodule_from_path(r, root_tree, tree_path);
 			st_entry->repo = xmalloc(sizeof(*st_entry->repo));
-- 
2.35.0.263.gb82422642f-goog



[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