Ejemplo n.º 1
0
/** Free memory used by a single valuepair.
 *
 * @todo TLV: needs to die in fire.
 */
void pairbasicfree(VALUE_PAIR *vp)
{
	if (!vp) return;

	VERIFY(vp);
	
	/*
	 *	The lack of DA means something has gone wrong
	 */
	if (!vp->da) {
		fr_strerror_printf("VALUE_PAIR has NULL DICT_ATTR pointer (probably already freed)");
	/*
	 *	Only free the DICT_ATTR if it was dynamically allocated
	 *	and was marked for free when the VALUE_PAIR is freed.
	 */
	} else if (vp->da->flags.vp_free) {
		dict_attr_free(&(vp->da));
	}

	/* clear the memory here */
#ifndef NDEBUG
	memset(vp, 0, sizeof(*vp));
#endif
	talloc_free(vp);
}
Ejemplo n.º 2
0
/** Release memory allocated to value pair template.
 *
 * @param[in,out] tmpl to free.
 */
void radius_tmplfree(value_pair_tmpl_t **tmpl)
{
	if (*tmpl == NULL) return;

	dict_attr_free(&((*tmpl)->da));

	talloc_free(*tmpl);

	*tmpl = NULL;
}