diff options
author | Andreas Steffen <andreas.steffen@strongswan.org> | 2009-04-24 15:01:32 +0000 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2009-04-24 15:01:32 +0000 |
commit | 6fd5b52f4cc930c8de2615f60cb82b913d8a5742 (patch) | |
tree | f72f2a855e50ae4e1e6f3f1ba06c45842ed0c7f6 /src | |
parent | adc25ec252244de4d9fe9e729175af5a50b44d96 (diff) | |
download | strongswan-6fd5b52f4cc930c8de2615f60cb82b913d8a5742.tar.bz2 strongswan-6fd5b52f4cc930c8de2615f60cb82b913d8a5742.tar.xz |
release dynamic memory allocated for VIDs
Diffstat (limited to 'src')
-rw-r--r-- | src/pluto/plutomain.c | 1 | ||||
-rw-r--r-- | src/pluto/vendor.c | 27 | ||||
-rw-r--r-- | src/pluto/vendor.h | 1 |
3 files changed, 20 insertions, 9 deletions
diff --git a/src/pluto/plutomain.c b/src/pluto/plutomain.c index ed7e195d7..34fa2f764 100644 --- a/src/pluto/plutomain.c +++ b/src/pluto/plutomain.c @@ -736,6 +736,7 @@ void exit_pluto(int status) free_crypto(); free_id(); /* free myids */ free_events(); /* free remaining events */ + free_vendorid(); /* free all vendor id records */ delete_lock(); library_deinit(); close_log(); diff --git a/src/pluto/vendor.c b/src/pluto/vendor.c index febf878bb..f984ff210 100644 --- a/src/pluto/vendor.c +++ b/src/pluto/vendor.c @@ -323,8 +323,7 @@ static const char _hexdig[] = "0123456789abcdef"; static int _vid_struct_init = 0; -void -init_vendorid(void) +void init_vendorid(void) { struct vid_struct *vid; MD5_CTX ctx; @@ -392,9 +391,21 @@ init_vendorid(void) _vid_struct_init = 1; } -static void -handle_known_vendorid (struct msg_digest *md -, const char *vidstr, size_t len, struct vid_struct *vid) +void free_vendorid(void) +{ + struct vid_struct *vid; + + for (vid = _vid_tab; vid->id; vid++) + { + if (vid->flags & (VID_STRING | VID_MD5HASH | VID_FSWAN_HASH)) + { + free(vid->vid); + } + } +} + +static void handle_known_vendorid (struct msg_digest *md, const char *vidstr, + size_t len, struct vid_struct *vid) { char vid_dump[128]; bool vid_useful = FALSE; @@ -481,8 +492,7 @@ handle_known_vendorid (struct msg_digest *md vid_useful ? "received" : "ignoring", vid_dump); } -void -handle_vendorid (struct msg_digest *md, const char *vid, size_t len) +void handle_vendorid (struct msg_digest *md, const char *vid, size_t len) { struct vid_struct *pvid; @@ -537,8 +547,7 @@ handle_vendorid (struct msg_digest *md, const char *vid, size_t len) /** * Add a vendor id payload to the msg */ -bool -out_vendorid (u_int8_t np, pb_stream *outs, enum known_vendorid vid) +bool out_vendorid (u_int8_t np, pb_stream *outs, enum known_vendorid vid) { struct vid_struct *pvid; diff --git a/src/pluto/vendor.h b/src/pluto/vendor.h index d8fa10d13..e657cb7d9 100644 --- a/src/pluto/vendor.h +++ b/src/pluto/vendor.h @@ -155,6 +155,7 @@ enum known_vendorid { }; void init_vendorid(void); +void free_vendorid(void); struct msg_digest; void handle_vendorid (struct msg_digest *md, const char *vid, size_t len); |