]> git.ipfire.org Git - thirdparty/git.git/commit - list-objects-filter-options.c
list-objects-filter-options: do not over-strbuf_init
authorMatthew DeVore <matvore@google.com>
Fri, 5 Oct 2018 21:31:26 +0000 (14:31 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 6 Oct 2018 23:55:00 +0000 (08:55 +0900)
commitcc0b05a4cc54c30a5355a9da5d76b1879d960628
tree35bbd54f2957dec2df68671ee51c0a33eef8fc33
parent696aa73905c8c11b06735f9db830e55bc369849a
list-objects-filter-options: do not over-strbuf_init

The function gently_parse_list_objects_filter is either called with
errbuf=STRBUF_INIT or errbuf=NULL, but that function calls strbuf_init
when errbuf is not NULL. strbuf_init is only necessary if errbuf
contains garbage, and risks a memory leak if errbuf already has a
non-STRBUF_INIT state. It should be the caller's responsibility to make
sure errbuf is not garbage, since garbage content is easily avoidable
with STRBUF_INIT.

Signed-off-by: Matthew DeVore <matvore@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
list-objects-filter-options.c