diff options
| author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2022-06-15 23:35:41 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-06-16 13:22:03 -0700 |
| commit | 41a86b64c093a6f36ffe0959aeed2e3f2590c7e8 (patch) | |
| tree | a750c35e5c5e9179cde66382f18cd6e0f100bd31 /builtin/submodule--helper.c | |
| parent | f53559227ccb600f4fdd1bfe08e1164a5aed60b5 (diff) | |
| download | git-41a86b64c093a6f36ffe0959aeed2e3f2590c7e8.tar.gz | |
submodule--helper: avoid memory leak when fetching submodules
In c51f8f94e5b3 (submodule--helper: run update procedures from C,
2021-08-24), we added code that first obtains the default remote, and
then adds that to a `strvec`.
However, we never released the default remote's memory.
Reported by Coverity.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/submodule--helper.c')
| -rw-r--r-- | builtin/submodule--helper.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 5c77dfcffe..c597df7528 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -2208,6 +2208,7 @@ static int fetch_in_submodule(const char *module_path, int depth, int quiet, str char *hex = oid_to_hex(oid); char *remote = get_default_remote(); strvec_pushl(&cp.args, remote, hex, NULL); + free(remote); } return run_command(&cp); |
