checkout: clarify memory ownership in unique_tracking_name()
The function `unique_tracking_name()` returns an allocated string, but does not clearly indicate this because its return type is `const char *` instead of `char *`. This has led to various callsites where we never free its returned memory at all, which causes memory leaks. Plug those leaks and mark now-passing tests as leak free. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
94e2aa555e
commit
cc395d6b47
@ -45,8 +45,8 @@ static int check_tracking_name(struct remote *remote, void *cb_data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *unique_tracking_name(const char *name, struct object_id *oid,
|
||||
int *dwim_remotes_matched)
|
||||
char *unique_tracking_name(const char *name, struct object_id *oid,
|
||||
int *dwim_remotes_matched)
|
||||
{
|
||||
struct tracking_name_data cb_data = TRACKING_NAME_DATA_INIT;
|
||||
const char *default_remote = NULL;
|
||||
|
Reference in New Issue
Block a user