mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
tools: Fix FILE memory leak in gpg-connect-agent.
* tools/gpg-connect-agent.c (do_open): dup the fileno and close the stream. GnuPG-bug-id: 4220 Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
793fd8d876
commit
378719f25f
@ -983,7 +983,7 @@ do_open (char *line)
|
||||
name, mode, strerror (errno));
|
||||
return;
|
||||
}
|
||||
fd = fileno (fp);
|
||||
fd = dup (fileno (fp));
|
||||
if (fd >= 0 && fd < DIM (open_fd_table))
|
||||
{
|
||||
open_fd_table[fd].inuse = 1;
|
||||
@ -1030,8 +1030,10 @@ do_open (char *line)
|
||||
else
|
||||
{
|
||||
log_error ("can't put fd %d into table\n", fd);
|
||||
close (fd);
|
||||
if (fd != -1)
|
||||
close (fd); /* Table was full. */
|
||||
}
|
||||
fclose (fp);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user