diff mbox series

[v2,5/6] submodule--helper: fix small memory leaks

Message ID patch-v2-5.6-a529c04a29a-20211022T085306Z-avarab@gmail.com (mailing list archive)
State Accepted
Commit c270b055d94b643b0ac8bcb390b82330aee01a34
Headers show
Series leaks: miscellaneous small leak fixes | expand

Commit Message

Ævar Arnfjörð Bjarmason Oct. 22, 2021, 8:55 a.m. UTC
Add a missing strbuf_release() and a clear_pathspec() to the
submodule--helper.

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

Patch

diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 6298cbdd4e5..a157656a48a 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -3220,6 +3220,7 @@  static void die_on_index_match(const char *path, int force)
 		}
 		free(ps_matched);
 	}
+	clear_pathspec(&ps);
 }
 
 static void die_on_repo_without_commits(const char *path)
@@ -3231,6 +3232,7 @@  static void die_on_repo_without_commits(const char *path)
 		if (resolve_gitlink_ref(path, "HEAD", &oid) < 0)
 			die(_("'%s' does not have a commit checked out"), path);
 	}
+	strbuf_release(&sb);
 }
 
 static int module_add(int argc, const char **argv, const char *prefix)