diff options
author | julien.pierre.bugs%sun.com <devnull@localhost> | 2006-05-04 01:05:04 +0000 |
---|---|---|
committer | julien.pierre.bugs%sun.com <devnull@localhost> | 2006-05-04 01:05:04 +0000 |
commit | 3aa0c1efe80f9d4b05804e5bfe9c694420f645c3 (patch) | |
tree | f4bd4db1ee2d2263490ca9e7cd84af13975ae76d /security/nss/lib/freebl/ecl/ecl.c | |
parent | 74bb4c79396b6fd6a21ea3d50c37ecbc3a59a8f4 (diff) | |
download | nss-hg-3aa0c1efe80f9d4b05804e5bfe9c694420f645c3.tar.gz |
Fix for bug 336335 - memory leaks in ECC code. r=wtchang
Diffstat (limited to 'security/nss/lib/freebl/ecl/ecl.c')
-rw-r--r-- | security/nss/lib/freebl/ecl/ecl.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/security/nss/lib/freebl/ecl/ecl.c b/security/nss/lib/freebl/ecl/ecl.c index 19874dd47..1356949b8 100644 --- a/security/nss/lib/freebl/ecl/ecl.c +++ b/security/nss/lib/freebl/ecl/ecl.c @@ -55,23 +55,24 @@ ECGroup_new() if (group == NULL) return NULL; group->constructed = MP_YES; + group->meth = NULL; group->text = NULL; MP_DIGITS(&group->curvea) = 0; MP_DIGITS(&group->curveb) = 0; MP_DIGITS(&group->genx) = 0; MP_DIGITS(&group->geny) = 0; MP_DIGITS(&group->order) = 0; - MP_CHECKOK(mp_init(&group->curvea)); - MP_CHECKOK(mp_init(&group->curveb)); - MP_CHECKOK(mp_init(&group->genx)); - MP_CHECKOK(mp_init(&group->geny)); - MP_CHECKOK(mp_init(&group->order)); group->base_point_mul = NULL; group->points_mul = NULL; group->validate_point = NULL; group->extra1 = NULL; group->extra2 = NULL; group->extra_free = NULL; + MP_CHECKOK(mp_init(&group->curvea)); + MP_CHECKOK(mp_init(&group->curveb)); + MP_CHECKOK(mp_init(&group->genx)); + MP_CHECKOK(mp_init(&group->geny)); + MP_CHECKOK(mp_init(&group->order)); CLEANUP: if (res != MP_OKAY) { @@ -406,6 +407,11 @@ ECGroup_free(ECGroup *group) GFMethod_free(group->meth); if (group->constructed == MP_NO) return; + mp_clear(&group->curvea); + mp_clear(&group->curveb); + mp_clear(&group->genx); + mp_clear(&group->geny); + mp_clear(&group->order); if (group->text != NULL) free(group->text); if (group->extra_free != NULL) |