/* * Frees a hdr_field structure, * WARNING: it frees only parsed (and not name.s, body.s) */ void clean_hdr_field(struct hdr_field* hf) { if (hf->parsed){ switch(hf->type){ case HDR_VIA_T: free_via_list(hf->parsed); hf->parsed = NULL; break; case HDR_TO_T: free_to(hf->parsed); hf->parsed = NULL; break; case HDR_FROM_T: free_to(hf->parsed); hf->parsed = NULL; break; case HDR_CSEQ_T: free_cseq(hf->parsed); hf->parsed = NULL; break; case HDR_CALLID_T: break; case HDR_CONTACT_T: free_contact((contact_body_t**)(void*)(&(hf->parsed))); break; case HDR_MAXFORWARDS_T: break; case HDR_ROUTE_T: free_rr((rr_t**)(void*)(&hf->parsed)); break; case HDR_RECORDROUTE_T: free_rr((rr_t**)(void*)(&hf->parsed)); break; case HDR_PATH_T: free_rr((rr_t**)(void*)(&hf->parsed)); break; case HDR_CONTENTTYPE_T: free_contenttype((content_t**)(void*)(&hf->parsed)); break; case HDR_CONTENTLENGTH_T: break; case HDR_AUTHORIZATION_T: free_credentials((auth_body_t**)(void*)(&(hf->parsed))); break; case HDR_EXPIRES_T: free_expires((exp_body_t**)(void*)(&(hf->parsed))); break; case HDR_PROXYAUTH_T: free_credentials((auth_body_t**)(void*)(&(hf->parsed))); break; case HDR_SUPPORTED_T: free_supported((struct supported_body**)(void*)(&(hf->parsed))); break; case HDR_PROXYREQUIRE_T: break; case HDR_UNSUPPORTED_T: break; case HDR_ALLOW_T: free_allow((struct allow_body**)(void*)(&(hf->parsed))); break; case HDR_EVENT_T: free_event((event_t**)(void*)(&(hf->parsed))); break; case HDR_ACCEPT_T: pkg_free(hf->parsed); hf->parsed = NULL; break; case HDR_ACCEPTLANGUAGE_T: break; case HDR_ORGANIZATION_T: break; case HDR_PRIORITY_T: break; case HDR_SUBJECT_T: break; case HDR_USERAGENT_T: break; case HDR_ACCEPTDISPOSITION_T: break; case HDR_CONTENTDISPOSITION_T: free_disposition( ((struct disposition**)(void*)(&hf->parsed)) ); break; case HDR_DIVERSION_T: free_to(hf->parsed); hf->parsed = NULL; break; case HDR_RPID_T: free_to(hf->parsed); hf->parsed = NULL; break; case HDR_REFER_TO_T: free_to(hf->parsed); hf->parsed = NULL; break; case HDR_SESSION_EXPIRES_T: free_session_expires((struct session_expires*)hf->parsed ); hf->parsed = NULL; break; case HDR_MIN_SE_T: break; case HDR_MIN_EXPIRES_T: break; case HDR_PPI_T: free_to(hf->parsed); hf->parsed = NULL; break; case HDR_PAI_T: free_to(hf->parsed); hf->parsed = NULL; break; case HDR_PRIVACY_T: break; case HDR_RETRY_AFTER_T: break; case HDR_CALL_INFO_T: free_call_info(hf->parsed); hf->parsed = NULL; break; case HDR_WWW_AUTHENTICATE_T: case HDR_PROXY_AUTHENTICATE_T: free_authenticate((struct authenticate_body *)hf->parsed); hf->parsed = NULL; break; default: LM_CRIT("unknown header type %d\n", hf->type); break; } } }
/** * 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); }