submodule--helper: fix small memory leaks

Add a missing strbuf_release() and a clear_pathspec() to the submodule--helper. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Oct 22, 2021 at 10:55 UTC c270b055d94b643b0ac8bcb390b82330aee01a34
1 file changed +2
builtin/submodule--helper.c
+2
@@ -3220,6 +3220,7 @@ static void die_on_index_match(const char *path, int force)
3220 }
3221 free(ps_matched);
3222 }
3223 + clear_pathspec(&ps);
3224 }
3225
3226 static void die_on_repo_without_commits(const char *path)
@@ -3231,6 +3232,7 @@ static void die_on_repo_without_commits(const char *path)
3232 if (resolve_gitlink_ref(path, "HEAD", &oid) < 0)
3233 die(_("'%s' does not have a commit checked out"), path);
3234 }
3235 + strbuf_release(&sb);
3236 }
3237
3238 static int module_add(int argc, const char **argv, const char *prefix)