indent(1): Fix memory leaks pointed out by clang-analyzer.
authorpfg <pfg@FreeBSD.org>
Tue, 23 Aug 2016 01:40:45 +0000 (01:40 +0000)
committerpfg <pfg@FreeBSD.org>
Tue, 23 Aug 2016 01:40:45 +0000 (01:40 +0000)
commitbfbdc169e5e099ef8c9f5de9a8d2e801195419c6
treebc70801f44a1e21b671148099b3f963e60abf8eb
parentc4c4ae0a3ae2c392c678824b4767d2749b07756d
indent(1): Fix memory leaks pointed out by clang-analyzer.

Shift the responsibility of allocating memory for the string duplicate
from the caller (set_option, add_typedefs_from_file) to the callee
(add_typename) as it has more knowledge about when the duplication
actually needs to occur.

Taken from: Piotr Stefaniak
usr.bin/indent/args.c
usr.bin/indent/lexi.c