diff options
| author | Jeff King <peff@peff.net> | 2025-11-18 07:21:24 -0500 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-11-18 10:05:14 -0800 |
| commit | 14b561e7685ee91d6a3d39684f9089c902641083 (patch) | |
| tree | fd9bf85d07705b21c4c3d2d64dbe7f1ea1d54e75 /t/unit-tests/u-string-list.c | |
| parent | bb5c624209fcaebd60b9572b2cc8c61086e39b57 (diff) | |
test-mktemp: plug memory and descriptor leaks
We test xmkstemp() in our helper by just calling:
xmkstemp(xstrdup(argv[1]));
This leaks both the copied string as well as the descriptor returned by
the function. In practice this isn't a big deal, since we immediately
exit the program, but:
1. LSan will complain about the memory leak. The only reason we did
not notice this in our leak-checking builds is that both of the
callers in the test suite (both in t0070) pass a broken template
(and expect failure). So the function calls die() before we can
actually leak.
But it's an accident waiting to happen if anybody adds a call which
succeeds.
2. Coverity complains about the descriptor leak. There's a long list
of uninteresting or false positives in Coverity's results, but
since we're here we might as well fix it, too.
I didn't bother adding a new test that triggers the leak. It's not even
in real production code, but just in the test-helper itself.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/unit-tests/u-string-list.c')
0 files changed, 0 insertions, 0 deletions
