]> git.ipfire.org Git - thirdparty/git.git/commitdiff
difftool: remove an unnecessary call to strbuf_release()
authorDavid Aguilar <davvid@gmail.com>
Fri, 1 Oct 2021 01:37:55 +0000 (18:37 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 1 Oct 2021 01:48:51 +0000 (18:48 -0700)
The `buf` strbuf is reused again later in the same function, so there
is no benefit to calling strbuf_release(). The subsequent usage is
already using strbuf_reset() to reset the buffer, so releasing it
early is only going to lead to a wasteful reallocation.

Remove the early call to strbuf_release(). The same strbuf is already
cleaned up in the "finish:" section so nothing is leaked, either.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/difftool.c

index be7ed2acaa686db1c28359cc2fa2d3e4407a4a22..1a415a15a3d3ac552aa8ebc0ebf16ed33d012d09 100644 (file)
@@ -568,8 +568,6 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
                write_standin_files(entry, &ldir, ldir_len, &rdir, rdir_len);
        }
 
-       strbuf_release(&buf);
-
        strbuf_setlen(&ldir, ldir_len);
        helper_argv[1] = ldir.buf;
        strbuf_setlen(&rdir, rdir_len);