]> git.ipfire.org Git - thirdparty/git.git/commitdiff
submodule--helper: fix small memory leaks
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Fri, 22 Oct 2021 08:55:43 +0000 (10:55 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sat, 23 Oct 2021 17:45:25 +0000 (10:45 -0700)
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>
builtin/submodule--helper.c

index 6298cbdd4e5f23aba5e47b5863737379bd60135e..a157656a48ac7ce694246ee6ff96c5070045bf5c 100644 (file)
@@ -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)