Module: sip-router Branch: 3.1 Commit: 7a3cf7dcf2b1bf7a8fa2f3c5a50af96fbb7712ad URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7a3cf7dc...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Mon Feb 28 11:15:53 2011 +0100
kcore: free SE parsed body through generic hdr free framework
- the parser for session-expires header uses now the generic header free framework (cherry picked from commit 1f092363559ebdcdbaf02cb5d8f093b6bea60b87)
---
lib/kcore/parse_sst.c | 13 ++++++++++++- lib/kcore/parse_sst.h | 1 + 2 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/lib/kcore/parse_sst.c b/lib/kcore/parse_sst.c index 1f4f5ea..9a5e9c1 100644 --- a/lib/kcore/parse_sst.c +++ b/lib/kcore/parse_sst.c @@ -68,6 +68,16 @@ malloc_session_expires( void ) return se; }
+/** + * wrapper to free the content of parsed session-expires header + */ +void hf_free_session_expires(void *parsed) +{ + struct session_expires *se; + se = (struct session_expires*)parsed; + free_session_expires(se); +} +
void free_session_expires( struct session_expires *se ) @@ -84,7 +94,7 @@ parse_session_expires_body( struct hdr_field *hf ) int pos = 0; int len = hf->body.len; char *q; - struct session_expires se = { 0, sst_refresher_unspecified }; + struct session_expires se = { 0, 0, sst_refresher_unspecified }; unsigned tok;
if ( !p || len <= 0 ) { @@ -165,6 +175,7 @@ parse_session_expires_body( struct hdr_field *hf ) LM_ERR(" out of pkg memory\n" ); return parse_sst_out_of_mem; } + se.hfree = hf_free_session_expires; *((struct session_expires *)hf->parsed) = se;
return parse_sst_success; diff --git a/lib/kcore/parse_sst.h b/lib/kcore/parse_sst.h index e4c2c62..79174a3 100644 --- a/lib/kcore/parse_sst.h +++ b/lib/kcore/parse_sst.h @@ -53,6 +53,7 @@ enum sst_refresher { * a pointer to a struct session_expires. */ struct session_expires { + hf_parsed_free_f hfree; /* function to free the content */ unsigned interval; /* in seconds */ enum sst_refresher refresher; };