From: Jim Meyering Date: Mon, 29 Jan 2007 13:18:28 +0000 (+0100) Subject: Plug a leak in ls. X-Git-Tag: COREUTILS-6_8~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=449a3751d1e00b383ff70f6ca4516bef58ce260d;p=thirdparty%2Fcoreutils.git Plug a leak in ls. * src/ls.c (print_dir): Don't leak a "DIR"+fd upon failure to determine dev/inode or upon detecting a symlink loop. --- diff --git a/ChangeLog b/ChangeLog index a90e169ddf..d0de2f44c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2007-01-29 Jim Meyering + Plug a leak in ls. + * src/ls.c (print_dir): Don't leak a "DIR"+fd upon failure to + determine dev/inode or upon detecting a symlink loop. + * src/ls.c: Rename three global variables. (cwd_file): Rename from 'files'. (cwd_n_alloc): Rename from 'nfiles'. diff --git a/src/ls.c b/src/ls.c index 4a6d7c1fb3..dbcc83ef4f 100644 --- a/src/ls.c +++ b/src/ls.c @@ -2342,6 +2342,7 @@ print_dir (char const *name, char const *realname, bool command_line_arg) { file_failure (command_line_arg, _("cannot determine device and inode of %s"), name); + closedir (dirp); return; } @@ -2351,6 +2352,7 @@ print_dir (char const *name, char const *realname, bool command_line_arg) { error (0, 0, _("%s: not listing already-listed directory"), quotearg_colon (name)); + closedir (dirp); return; }