diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-04-01 12:23:16 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-04-01 14:04:23 -0700 |
commit | 1ea4d9b7c8008f5172e9995d87e2cf2d594a7ac7 (patch) | |
tree | ef6ba1be1cff7ab12a0dacd84a412b7cad2ad0cb /builtin/diff-tree.c | |
parent | submodule--helper, module_clone: always operate on absolute paths (diff) | |
download | tgif-1ea4d9b7c8008f5172e9995d87e2cf2d594a7ac7.tar.xz |
submodule--helper: do not borrow absolute_path() result for too long
absolute_path() is designed to allow its callers to take a brief
peek of the result (typically, to be fed to functions like
strbuf_add() and relative_path() as a parameter) without having to
worry about freeing it, but the other side of the coin of that
memory model is that the caller shouldn't rely too much on the
result living forever--there may be a helper function the caller
subsequently calls that makes its own call to absolute_path(),
invalidating the earlier result.
Use xstrdup() to make our own copy, and free(3) it when we are done.
While at it, remove an unnecessary sm_gitdir_rel variable that was
only used to as a parameter to call absolute_path() and never used
again.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/diff-tree.c')
0 files changed, 0 insertions, 0 deletions