mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
dirmngr: Fix error code path of map_host.
* dirmngr/ks-engine-hkp.c (map_host): Fix error return. -- In ks-engine-hkp.c on line 509 'reftbl' is freed, but it is then used on line 511. I'm guessing this is a missing return;. Reported-by: Joshua Rogers <honey@internot.info> Debian-Bug-Id: 773520 Other fixes on error added too.
This commit is contained in:
parent
100b322f5d
commit
657a26f3af
@ -325,6 +325,7 @@ static gpg_error_t
|
|||||||
map_host (ctrl_t ctrl, const char *name, int force_reselect,
|
map_host (ctrl_t ctrl, const char *name, int force_reselect,
|
||||||
char **r_host, unsigned int *r_httpflags, char **r_poolname)
|
char **r_host, unsigned int *r_httpflags, char **r_poolname)
|
||||||
{
|
{
|
||||||
|
gpg_error_t err = 0;
|
||||||
hostinfo_t hi;
|
hostinfo_t hi;
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
@ -361,8 +362,9 @@ map_host (ctrl_t ctrl, const char *name, int force_reselect,
|
|||||||
idx = create_new_hostinfo (name);
|
idx = create_new_hostinfo (name);
|
||||||
if (idx == -1)
|
if (idx == -1)
|
||||||
{
|
{
|
||||||
|
err = gpg_error_from_syserror ();
|
||||||
xfree (reftbl);
|
xfree (reftbl);
|
||||||
return gpg_error_from_syserror ();
|
return err;
|
||||||
}
|
}
|
||||||
hi = hosttable[idx];
|
hi = hosttable[idx];
|
||||||
|
|
||||||
@ -504,9 +506,11 @@ map_host (ctrl_t ctrl, const char *name, int force_reselect,
|
|||||||
hi->pool = xtryrealloc (reftbl, (refidx+1) * sizeof *reftbl);
|
hi->pool = xtryrealloc (reftbl, (refidx+1) * sizeof *reftbl);
|
||||||
if (!hi->pool)
|
if (!hi->pool)
|
||||||
{
|
{
|
||||||
|
err = gpg_error_from_syserror ();
|
||||||
log_error ("shrinking index table in map_host failed: %s\n",
|
log_error ("shrinking index table in map_host failed: %s\n",
|
||||||
strerror (errno));
|
gpg_strerror (err));
|
||||||
xfree (reftbl);
|
xfree (reftbl);
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
qsort (reftbl, refidx, sizeof *reftbl, sort_hostpool);
|
qsort (reftbl, refidx, sizeof *reftbl, sort_hostpool);
|
||||||
}
|
}
|
||||||
@ -570,12 +574,13 @@ map_host (ctrl_t ctrl, const char *name, int force_reselect,
|
|||||||
*r_host = xtrystrdup (hi->name);
|
*r_host = xtrystrdup (hi->name);
|
||||||
if (!*r_host)
|
if (!*r_host)
|
||||||
{
|
{
|
||||||
|
err = gpg_error_from_syserror ();
|
||||||
if (r_poolname)
|
if (r_poolname)
|
||||||
{
|
{
|
||||||
xfree (*r_poolname);
|
xfree (*r_poolname);
|
||||||
*r_poolname = NULL;
|
*r_poolname = NULL;
|
||||||
}
|
}
|
||||||
return gpg_error_from_syserror ();
|
return err;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user