summaryrefslogtreecommitdiffstats
path: root/agent/gpg-agent.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2017-05-30 06:56:20 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2017-05-30 06:56:20 +0200
commit996544626ea416c173a940db47f47f9e5cbd844c (patch)
tree40ca4e161d0e75ee20aff03fbf6ada41c42cd7d9 /agent/gpg-agent.c
parentdirmngr: This towel should better detect a changed resolv.conf. (diff)
downloadgnupg2-996544626ea416c173a940db47f47f9e5cbd844c.tar.xz
gnupg2-996544626ea416c173a940db47f47f9e5cbd844c.zip
agent: Fix memory leaks.
* agent/divert-scd.c (ask_for_card): Free WANT_KID and WANT_SN_DISP. * agent/gpg-agent.c (create_server_socket): Free UNADDR. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to '')
-rw-r--r--agent/gpg-agent.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index 77b811cbb..44b9be21d 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -2129,6 +2129,7 @@ create_server_socket (char *name, int primary, int cygwin,
log_error ("error preparing socket '%s': %s\n",
name, gpg_strerror (gpg_error_from_syserror ()));
*name = 0; /* Inhibit removal of the socket by cleanup(). */
+ xfree (unaddr);
agent_exit (2);
}
if (redirected)
@@ -2166,6 +2167,7 @@ create_server_socket (char *name, int primary, int cygwin,
"not starting a new one\n"));
*name = 0; /* Inhibit removal of the socket by cleanup(). */
assuan_sock_close (fd);
+ xfree (unaddr);
agent_exit (2);
}
gnupg_remove (unaddr->sun_path);
@@ -2178,11 +2180,12 @@ create_server_socket (char *name, int primary, int cygwin,
/* We use gpg_strerror here because it allows us to get strings
for some W32 socket error codes. */
log_error (_("error binding socket to '%s': %s\n"),
- unaddr->sun_path,
+ unaddr->sun_path,
gpg_strerror (gpg_error_from_syserror ()));
assuan_sock_close (fd);
*name = 0; /* Inhibit removal of the socket by cleanup(). */
+ xfree (unaddr);
agent_exit (2);
}
@@ -2195,12 +2198,14 @@ create_server_socket (char *name, int primary, int cygwin,
log_error (_("listen() failed: %s\n"), strerror (errno));
*name = 0; /* Inhibit removal of the socket by cleanup(). */
assuan_sock_close (fd);
+ xfree (unaddr);
agent_exit (2);
}
if (opt.verbose)
log_info (_("listening on socket '%s'\n"), unaddr->sun_path);
+ xfree (unaddr);
return fd;
}