mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
scd: Fix resource leaks on error paths.
* scd/app-dinsig.c (do_readcert): Don't return directly but care about releasing memory. * scd/app-nks.c (readcert_from_ef): Likewise. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
d37971b45f
commit
b1f2695d24
@ -226,7 +226,10 @@ do_readcert (app_t app, const char *certid,
|
|||||||
else if ( class == CLASS_UNIVERSAL && tag == TAG_SET && constructed )
|
else if ( class == CLASS_UNIVERSAL && tag == TAG_SET && constructed )
|
||||||
rootca = 1;
|
rootca = 1;
|
||||||
else
|
else
|
||||||
return gpg_error (GPG_ERR_INV_OBJ);
|
{
|
||||||
|
err = gpg_error (GPG_ERR_INV_OBJ);
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
totobjlen = objlen + hdrlen;
|
totobjlen = objlen + hdrlen;
|
||||||
log_assert (totobjlen <= buflen);
|
log_assert (totobjlen <= buflen);
|
||||||
|
|
||||||
|
@ -999,7 +999,10 @@ readcert_from_ef (app_t app, int fid, unsigned char **cert, size_t *certlen)
|
|||||||
else if ( class == CLASS_UNIVERSAL && tag == TAG_SET && constructed )
|
else if ( class == CLASS_UNIVERSAL && tag == TAG_SET && constructed )
|
||||||
rootca = 1;
|
rootca = 1;
|
||||||
else
|
else
|
||||||
return gpg_error (GPG_ERR_INV_OBJ);
|
{
|
||||||
|
err = gpg_error (GPG_ERR_INV_OBJ);
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
totobjlen = objlen + hdrlen;
|
totobjlen = objlen + hdrlen;
|
||||||
log_assert (totobjlen <= buflen);
|
log_assert (totobjlen <= buflen);
|
||||||
|
|
||||||
@ -1030,7 +1033,10 @@ readcert_from_ef (app_t app, int fid, unsigned char **cert, size_t *certlen)
|
|||||||
if (err)
|
if (err)
|
||||||
goto leave;
|
goto leave;
|
||||||
if ( !(class == CLASS_UNIVERSAL && tag == TAG_SEQUENCE && constructed) )
|
if ( !(class == CLASS_UNIVERSAL && tag == TAG_SEQUENCE && constructed) )
|
||||||
return gpg_error (GPG_ERR_INV_OBJ);
|
{
|
||||||
|
err = gpg_error (GPG_ERR_INV_OBJ);
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
totobjlen = objlen + hdrlen;
|
totobjlen = objlen + hdrlen;
|
||||||
log_assert (save_p + totobjlen <= buffer + buflen);
|
log_assert (save_p + totobjlen <= buffer + buflen);
|
||||||
memmove (buffer, save_p, totobjlen);
|
memmove (buffer, save_p, totobjlen);
|
||||||
@ -1144,7 +1150,7 @@ iterate_over_filelist (app_t app, const char *want_keygripstr, int capability,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Found. Return but save the last idenx of the loop. */
|
/* Found. Return but save the last index of the loop. */
|
||||||
*idx_p = idx;
|
*idx_p = idx;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user