From b4f455f834e621c58c0750660b9e63ccbb01f695 Mon Sep 17 00:00:00 2001 From: Andrei Pelinescu-Onciul Date: Thu, 5 Aug 2010 22:38:24 +0200 Subject: [PATCH] core: pvapi: added pv_spec_free_contents() Added pv_spec_free_contents() that behaves like pv_spec_free(), but frees only the contents of the pv_spec and not the pv_spec itself (good for cleaning up pv_specs that are part of other structures). --- pvapi.c | 16 +++++++++++++--- pvar.h | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/pvapi.c b/pvapi.c index 72024cd9ae..76105342af 100644 --- a/pvapi.c +++ b/pvapi.c @@ -1075,15 +1075,25 @@ error: return NULL; } + + +/** frees only the contests of a pv_spec_t. */ +void pv_spec_free_contents(pv_spec_t *spec) +{ + /* TODO: free name if it is PV */ + if(spec->trans) + tr_free((trans_t*)spec->trans); +} + + + /** * */ void pv_spec_free(pv_spec_t *spec) { if(spec==0) return; - /* TODO: free name if it is PV */ - if(spec->trans) - tr_free((trans_t*)spec->trans); + pv_spec_free_contents(spec); pkg_free(spec); } diff --git a/pvar.h b/pvar.h index 19b931024b..b1a5cfa134 100644 --- a/pvar.h +++ b/pvar.h @@ -175,6 +175,7 @@ int pv_printf(struct sip_msg* msg, pv_elem_p list, char *buf, int *len); int pv_elem_free_all(pv_elem_p log); void pv_value_destroy(pv_value_t *val); void pv_spec_free(pv_spec_t *spec); +void pv_spec_free_contents(pv_spec_t* spec); int pv_spec_dbg(pv_spec_p sp); int pv_get_spec_index(struct sip_msg* msg, pv_param_p ip, int *idx, int *flags); int pv_get_avp_name(struct sip_msg* msg, pv_param_p ip, int_str *avp_name, -- 2.20.1