summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Domonkos <mdomonko@redhat.com>2021-06-14 12:34:23 +0200
committerPanu Matilainen <pmatilai@redhat.com>2021-08-20 11:44:09 +0300
commit4d4890c3c4fcfb026b77fcf92751ec71146575ba (patch)
tree4ea72237338eca740f74b12566d0a023eae31549
parentaccb1db4ac935465d4dead66d318b3f04504665d (diff)
downloadrpm-4d4890c3c4fcfb026b77fcf92751ec71146575ba.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. (cherry picked from commit 39b7bf8579e0522cf16347b3a7e332d3b6d742c6)
-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);
}