aboutsummaryrefslogtreecommitdiffstats
path: root/src/pluto/keys.c
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2011-02-10 15:50:58 +0100
committerTobias Brunner <tobias@strongswan.org>2011-02-10 16:49:42 +0100
commitc38877b395fe976f5b91439a304e588744436990 (patch)
tree4b3acfca6447c6595f288b4d41d503bbc3cf6c82 /src/pluto/keys.c
parente185d78fc9c4fb163597a25950c18dc22d24a6d8 (diff)
downloadstrongswan-c38877b395fe976f5b91439a304e588744436990.tar.bz2
strongswan-c38877b395fe976f5b91439a304e588744436990.tar.xz
pluto: Properly free secrets in error cases.
Diffstat (limited to 'src/pluto/keys.c')
-rw-r--r--src/pluto/keys.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/pluto/keys.c b/src/pluto/keys.c
index a79c2c0d2..86b46c6c1 100644
--- a/src/pluto/keys.c
+++ b/src/pluto/keys.c
@@ -902,6 +902,7 @@ static void process_secret(secret_t *s, int whackfd)
{
loglog(RC_LOG_SERIOUS, "\"%s\" line %d: %s"
, flp->filename, flp->lino, ugh);
+ s->ids->destroy_offset(s->ids, offsetof(identification_t, destroy));
free(s);
}
else if (flushline("expected record boundary in key"))
@@ -1010,8 +1011,11 @@ static void process_secret_records(int whackfd)
if (!shift())
{
/* unexpected Record Boundary or EOF */
- loglog(RC_LOG_SERIOUS, "\"%s\" line %d: unexpected end of id list"
- , flp->filename, flp->lino);
+ loglog(RC_LOG_SERIOUS, "\"%s\" line %d: unexpected end"
+ " of id list", flp->filename, flp->lino);
+ s->ids->destroy_offset(s->ids,
+ offsetof(identification_t, destroy));
+ free(s);
break;
}
}