Merge branch 'ab/leakfix'

Plug various memory leaks.

* ab/leakfix:
  pull: fix a "struct oid_array" memory leak
  cat-file: fix a common "struct object_context" memory leak
  gc: fix a memory leak
  checkout: avoid "struct unpack_trees_options" leak
  merge-file: fix memory leaks on error path
  merge-file: refactor for subsequent memory leak fix
  cat-file: fix a memory leak in --batch-command mode
  revert: free "struct replay_opts" members
  submodule.c: free() memory from xgetcwd()
  clone: fix memory leak in wanted_peer_refs()
  check-ref-format: fix trivial memory leak
This commit is contained in:
Junio C Hamano
2022-07-18 13:31:54 -07:00
26 changed files with 114 additions and 54 deletions

View File

@ -2388,7 +2388,7 @@ int get_superproject_working_tree(struct strbuf *buf)
struct child_process cp = CHILD_PROCESS_INIT;
struct strbuf sb = STRBUF_INIT;
struct strbuf one_up = STRBUF_INIT;
const char *cwd = xgetcwd();
char *cwd = xgetcwd();
int ret = 0;
const char *subpath;
int code;
@ -2451,6 +2451,7 @@ int get_superproject_working_tree(struct strbuf *buf)
ret = 1;
free(super_wt);
}
free(cwd);
strbuf_release(&sb);
code = finish_command(&cp);