summaryrefslogtreecommitdiff
path: root/misc/fts.c
diff options
context:
space:
mode:
authorMichal Domonkos <mdomonko@redhat.com>2021-06-14 12:34:23 +0200
committerFlorian Festi <ffesti@redhat.com>2021-06-28 13:22:53 +0200
commit39b7bf8579e0522cf16347b3a7e332d3b6d742c6 (patch)
tree324733f34d1e76dda83ccf777c0f4b15e6eb655f /misc/fts.c
parent3c8b01b67ec907afaaffe71691fa41b878578527 (diff)
downloadrpm-39b7bf8579e0522cf16347b3a7e332d3b6d742c6.tar.gz
Fix memory leak in fts_build()
Turns out this leak is already fixed in glibc's current version of fts.c (where our copy originates from), so let's just backport that. Original commit in glibc: https://sourceware.org/git/?p=glibc.git;\ a=commit;h=db67c2c98b89a5723af44df54f38b779de8d4a65 Found by Coverity.
Diffstat (limited to 'misc/fts.c')
-rw-r--r--misc/fts.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/misc/fts.c b/misc/fts.c
index caf27495d..f7fce0eaa 100644
--- a/misc/fts.c
+++ b/misc/fts.c
@@ -855,6 +855,7 @@ mem1: saved_errno = errno;
fts_safe_changedir(sp, cur->fts_parent, -1, ".."))) {
cur->fts_info = FTS_ERR;
SET(FTS_STOP);
+ fts_lfree(head);
return (NULL);
}
@@ -862,6 +863,7 @@ mem1: saved_errno = errno;
if (!nitems) {
if (type == BREAD)
cur->fts_info = FTS_DP;
+ fts_lfree(head);
return (NULL);
}