]> git.ipfire.org Git - thirdparty/git.git/commit - gpg-interface.c
gpg-interface: fix leak of strbufs in get_ssh_key_fingerprint()
authorJeff King <peff@peff.net>
Mon, 18 Oct 2021 17:15:37 +0000 (13:15 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 18 Oct 2021 20:16:53 +0000 (13:16 -0700)
commitf3af71c947cdf2e5acd16cacf50586b829a68f6e
tree3c1672c317ae47228a344c45e7576d0d1b89bbde
parent78d468f1a9c7bf9d1724840ff322b9144061b308
gpg-interface: fix leak of strbufs in get_ssh_key_fingerprint()

We read stdout from gpg into a strbuf, then split it into a list of
strbufs, pull out one element, and return it. But we don't free either
the original stdout buffer, nor the list returned from strbuf_split().

This patch fixes both. Note that we have to detach the returned string
from its strbuf before calling strbuf_list_free(), as that would
otherwise throw it away.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gpg-interface.c