Skip to content

Commit 41a86b6

Browse files
dschogitster
authored andcommitted
submodule--helper: avoid memory leak when fetching submodules
In c51f8f9 (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f535592 commit 41a86b6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

builtin/submodule--helper.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2208,6 +2208,7 @@ static int fetch_in_submodule(const char *module_path, int depth, int quiet, str
22082208
char *hex = oid_to_hex(oid);
22092209
char *remote = get_default_remote();
22102210
strvec_pushl(&cp.args, remote, hex, NULL);
2211+
free(remote);
22112212
}
22122213

22132214
return run_command(&cp);

0 commit comments

Comments
 (0)