mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-13 22:21:09 +02:00
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>
This commit is contained in:
parent
de3a0988ef
commit
996544626e
@ -52,6 +52,7 @@ ask_for_card (ctrl_t ctrl, const unsigned char *shadow_info, char **r_kid)
|
|||||||
{
|
{
|
||||||
rc = gpg_error_from_syserror ();
|
rc = gpg_error_from_syserror ();
|
||||||
xfree (want_sn);
|
xfree (want_sn);
|
||||||
|
xfree (want_kid);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,6 +85,7 @@ ask_for_card (ctrl_t ctrl, const unsigned char *shadow_info, char **r_kid)
|
|||||||
serialno = NULL;
|
serialno = NULL;
|
||||||
if (!i)
|
if (!i)
|
||||||
{
|
{
|
||||||
|
xfree (want_sn_disp);
|
||||||
xfree (want_sn);
|
xfree (want_sn);
|
||||||
*r_kid = want_kid;
|
*r_kid = want_kid;
|
||||||
return 0; /* yes, we have the correct card */
|
return 0; /* yes, we have the correct card */
|
||||||
@ -122,9 +124,9 @@ ask_for_card (ctrl_t ctrl, const unsigned char *shadow_info, char **r_kid)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
rc = agent_get_confirmation (ctrl, desc, NULL, NULL, 0);
|
rc = agent_get_confirmation (ctrl, desc, NULL, NULL, 0);
|
||||||
if (ctrl->pinentry_mode == PINENTRY_MODE_LOOPBACK &&
|
if (ctrl->pinentry_mode == PINENTRY_MODE_LOOPBACK &&
|
||||||
gpg_err_code (rc) == GPG_ERR_NO_PIN_ENTRY)
|
gpg_err_code (rc) == GPG_ERR_NO_PIN_ENTRY)
|
||||||
rc = gpg_error (GPG_ERR_CARD_NOT_PRESENT);
|
rc = gpg_error (GPG_ERR_CARD_NOT_PRESENT);
|
||||||
|
|
||||||
xfree (desc);
|
xfree (desc);
|
||||||
}
|
}
|
||||||
|
@ -2129,6 +2129,7 @@ create_server_socket (char *name, int primary, int cygwin,
|
|||||||
log_error ("error preparing socket '%s': %s\n",
|
log_error ("error preparing socket '%s': %s\n",
|
||||||
name, gpg_strerror (gpg_error_from_syserror ()));
|
name, gpg_strerror (gpg_error_from_syserror ()));
|
||||||
*name = 0; /* Inhibit removal of the socket by cleanup(). */
|
*name = 0; /* Inhibit removal of the socket by cleanup(). */
|
||||||
|
xfree (unaddr);
|
||||||
agent_exit (2);
|
agent_exit (2);
|
||||||
}
|
}
|
||||||
if (redirected)
|
if (redirected)
|
||||||
@ -2166,6 +2167,7 @@ create_server_socket (char *name, int primary, int cygwin,
|
|||||||
"not starting a new one\n"));
|
"not starting a new one\n"));
|
||||||
*name = 0; /* Inhibit removal of the socket by cleanup(). */
|
*name = 0; /* Inhibit removal of the socket by cleanup(). */
|
||||||
assuan_sock_close (fd);
|
assuan_sock_close (fd);
|
||||||
|
xfree (unaddr);
|
||||||
agent_exit (2);
|
agent_exit (2);
|
||||||
}
|
}
|
||||||
gnupg_remove (unaddr->sun_path);
|
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
|
/* We use gpg_strerror here because it allows us to get strings
|
||||||
for some W32 socket error codes. */
|
for some W32 socket error codes. */
|
||||||
log_error (_("error binding socket to '%s': %s\n"),
|
log_error (_("error binding socket to '%s': %s\n"),
|
||||||
unaddr->sun_path,
|
unaddr->sun_path,
|
||||||
gpg_strerror (gpg_error_from_syserror ()));
|
gpg_strerror (gpg_error_from_syserror ()));
|
||||||
|
|
||||||
assuan_sock_close (fd);
|
assuan_sock_close (fd);
|
||||||
*name = 0; /* Inhibit removal of the socket by cleanup(). */
|
*name = 0; /* Inhibit removal of the socket by cleanup(). */
|
||||||
|
xfree (unaddr);
|
||||||
agent_exit (2);
|
agent_exit (2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2195,12 +2198,14 @@ create_server_socket (char *name, int primary, int cygwin,
|
|||||||
log_error (_("listen() failed: %s\n"), strerror (errno));
|
log_error (_("listen() failed: %s\n"), strerror (errno));
|
||||||
*name = 0; /* Inhibit removal of the socket by cleanup(). */
|
*name = 0; /* Inhibit removal of the socket by cleanup(). */
|
||||||
assuan_sock_close (fd);
|
assuan_sock_close (fd);
|
||||||
|
xfree (unaddr);
|
||||||
agent_exit (2);
|
agent_exit (2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt.verbose)
|
if (opt.verbose)
|
||||||
log_info (_("listening on socket '%s'\n"), unaddr->sun_path);
|
log_info (_("listening on socket '%s'\n"), unaddr->sun_path);
|
||||||
|
|
||||||
|
xfree (unaddr);
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user