diff options
author | Pádraig Brady <P@draigBrady.com> | 2018-05-13 18:42:37 -0700 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2018-05-20 23:13:32 -0700 |
commit | e90c77eb2608f23caa798a9910d8dc0f9901904a (patch) | |
tree | 3ea4c13a2cf2d8c02e79d62b8793929771a11266 /lib/fts.c | |
parent | 1193175efd58883626d2b8c454b57a9490538d61 (diff) | |
download | gnulib-e90c77eb2608f23caa798a9910d8dc0f9901904a.tar.gz |
fts: avoid a memory leak edge case
* lib/fts.c (fts_open): Set an appropriate fts_level
so that an immediate fts_close() will free the allocation.
* tests/test-fts.c (fts_dealloc): Add a test case which
will trigger under valgrind or address sanitizer.
Fixes https://bugs.gnu.org/31439
Diffstat (limited to 'lib/fts.c')
-rw-r--r-- | lib/fts.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -546,6 +546,7 @@ fts_open (char * const *argv, goto mem3; sp->fts_cur->fts_link = root; sp->fts_cur->fts_info = FTS_INIT; + sp->fts_cur->fts_level = 1; if (! setup_dir (sp)) goto mem3; |