public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [gentoo-commits] proj/portage-utils:master commit in: /
@ 2015-11-26 10:39 99% Mike Frysinger
  0 siblings, 0 replies; 1+ results
From: Mike Frysinger @ 2015-11-26 10:39 UTC (permalink / raw
  To: gentoo-commits

commit:     58513b6cba580354031623c11049ab8e0a8e6970
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 26 09:48:28 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Nov 26 09:48:28 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=58513b6c

quse: fix invalid close

This happens to work normally as we only have fds {0,1,2} open
and {3} is the active file we're working on.  Since the f loop
contains 3 (for an unrelated reason), we close the right fd.
But if there are more/fewer fd's open at start, it might fail,
and we leak the FILE* structure.  Switch to closing the right
file pointer to avoid all this mess.

 quse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/quse.c b/quse.c
index c7c1863..5ef88da 100644
--- a/quse.c
+++ b/quse.c
@@ -205,7 +205,7 @@ quse_describe_flag(unsigned int ind, unsigned int argc, char **argv)
 				if (!strcmp(argv[i], buf))
 					printf(" %s%s%s:%s%s%s: %s\n", BOLD, de->d_name, NORM, BLUE, argv[i], NORM, p);
 		}
-		close(f);
+		fclose(fp[0]);
 	}
 	closedir(d);
 


^ permalink raw reply related	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2015-11-26 10:39 99% [gentoo-commits] proj/portage-utils:master commit in: / Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox