[Bug 238042] Potential memory leak in fts_build of lib/libc/gen/fts-compat.c

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed May 22 07:54:00 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238042

            Bug ID: 238042
           Summary: Potential memory leak in fts_build of
                    lib/libc/gen/fts-compat.c
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: bugs at FreeBSD.org
          Reporter: yangx92 at hotmail.com

There is a potential memory leak in fts_build of lib/libc/gen/fts-compat.c,
which is the same as bug that was fixed in
https://github.com/freebsd/freebsd/commit/ccdcef45ea7587b77198e50c3e9d11f80e9378f0.


fts_build(FTS *sp, int type)
{
        struct freebsd11_dirent *dp;
        FTSENT *p, *head;

        ...

        if (descend && (type == BCHILD || !nitems) &&
            (cur->fts_level == FTS_ROOTLEVEL ?
            FCHDIR(sp, sp->fts_rfd) :
            fts_safe_changedir(sp, cur->fts_parent, -1, ".."))) {
                cur->fts_info = FTS_ERR;
                SET(FTS_STOP);
                return (NULL);  //memory leak here
        }

        if (!nitems) {
                if (type == BREAD)
                        cur->fts_info = FTS_DP;
                return (NULL);  //memory leak here
        }
...
}

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list