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>

Johannes Schindelin committed Jun 15, 2022 at 23:35 UTC 41a86b64c093a6f36ffe0959aeed2e3f2590c7e8
1 file changed +1
builtin/submodule--helper.c
+1
@@ -2208,6 +2208,7 @@ static int fetch_in_submodule(const char *module_path, int depth, int quiet, str
2208 char *hex = oid_to_hex(oid);
2209 char *remote = get_default_remote();
2210 strvec_pushl(&cp.args, remote, hex, NULL);
2211 + free(remote);
2212 }
2213
2214 return run_command(&cp);