Index: .hgtags
===================================================================
--- .hgtags	(revision 1150)
+++ .hgtags	(revision 1143)
@@ -56,6 +56,2 @@
 75633912f364ad94a82e197d918c75b4745998f8 proposed_merged
 7ef8ab1d664f300fb5ad8f102c8b2fdafa609518 proposed_merged
-7ef8ab1d664f300fb5ad8f102c8b2fdafa609518 proposed_merged
-7b57dc5a681fd642a218971da9af9af7356152d9 proposed_merged
-7b57dc5a681fd642a218971da9af9af7356152d9 proposed_merged
-5d19d6f3e1bd03adc8869e294d0c4b13e0977fd6 proposed_merged
Index: extensions/app_diameap/diameap_eap.c
===================================================================
--- extensions/app_diameap/diameap_eap.c	(revision 1075)
+++ extensions/app_diameap/diameap_eap.c	(revision 1151)
@@ -92,10 +92,10 @@
 	*vendor = 0;
 	*eaptype = TYPE_NONE;
+	if (eap_sm == NULL)
+	{
+		return EINVAL;
+	}
+
 	eap_sm->selectedMethod = NULL;
-
-	if (eap_sm == NULL)
-	{
-		return EINVAL;
-	}
 
 	if (eap_sm->user.userid == NULL)
Index: extensions/app_diameap/diameap_server.c
===================================================================
--- extensions/app_diameap/diameap_server.c	(revision 1120)
+++ extensions/app_diameap/diameap_server.c	(revision 1151)
@@ -1131,14 +1131,14 @@
 static void free_ans_attrib(struct avp_attribute * ans_attrib)
 {
-	if (ans_attrib->tofree == 1)
-	{
-		if(ans_attrib->value.os.data){
-		free(ans_attrib->value.os.data);
-		ans_attrib->value.os.data = NULL;
-		}
-	}
 	if(ans_attrib){
-	free(ans_attrib);
-	ans_attrib = NULL;
+		if (ans_attrib->tofree == 1)
+		{
+			if(ans_attrib->value.os.data){
+			free(ans_attrib->value.os.data);
+			ans_attrib->value.os.data = NULL;
+			}
+		}
+		free(ans_attrib);
+		ans_attrib = NULL;
 	}
 }
@@ -1185,62 +1185,62 @@
 {
 
-	if (diameap_sm->eap_sm.user.userid != NULL)
-	{
-		free(diameap_sm->eap_sm.user.userid);
-		diameap_sm->eap_sm.user.userid = NULL;
-	}
-
-	if (diameap_sm->eap_sm.user.password != NULL)
-	{
-		free(diameap_sm->eap_sm.user.password);
-		diameap_sm->eap_sm.user.password = NULL;
-	}
-
-	diameap_sm->eap_sm.selectedMethod = NULL;
-
-	if (diameap_sm->eap_sm.methodData != NULL)
-	{
-
-		struct plugin * cplugin;
-		if (diameap_plugin_get(diameap_sm->eap_sm.currentVendor,
-				diameap_sm->eap_sm.currentMethod, &cplugin))
-		{
-			TRACE_DEBUG(INFO,"%sUnable to access EAP Method plugin {Type=%d, Vendor=%d}.",DIAMEAP_EXTENSION,diameap_sm->eap_sm.currentMethod,diameap_sm->eap_sm.currentVendor);
-		}
-
-		if (cplugin->eap_method_free)
-		{
-			(*cplugin->eap_method_free)(diameap_sm->eap_sm.methodData);
-			diameap_sm->eap_sm.methodData = NULL;
-		}
-		else
-		{
-			TRACE_DEBUG(INFO,"%s[%s plugin] datafree function not available.",DIAMEAP_EXTENSION,cplugin->methodname);
-			if (diameap_sm->eap_sm.methodData != NULL)
-			{
-				free(diameap_sm->eap_sm.methodData);
+	if (diameap_sm != NULL)
+	{
+		if (diameap_sm->eap_sm.user.userid != NULL)
+		{
+			free(diameap_sm->eap_sm.user.userid);
+			diameap_sm->eap_sm.user.userid = NULL;
+		}
+
+		if (diameap_sm->eap_sm.user.password != NULL)
+		{
+			free(diameap_sm->eap_sm.user.password);
+			diameap_sm->eap_sm.user.password = NULL;
+		}
+
+		diameap_sm->eap_sm.selectedMethod = NULL;
+
+		if (diameap_sm->eap_sm.methodData != NULL)
+		{
+
+			struct plugin * cplugin;
+			if (diameap_plugin_get(diameap_sm->eap_sm.currentVendor,
+					diameap_sm->eap_sm.currentMethod, &cplugin))
+			{
+				TRACE_DEBUG(INFO,"%sUnable to access EAP Method plugin {Type=%d, Vendor=%d}.",DIAMEAP_EXTENSION,diameap_sm->eap_sm.currentMethod,diameap_sm->eap_sm.currentVendor);
+			}
+
+			if (cplugin->eap_method_free)
+			{
+				(*cplugin->eap_method_free)(diameap_sm->eap_sm.methodData);
 				diameap_sm->eap_sm.methodData = NULL;
 			}
-		}
-		if (diameap_sm->eap_sm.methodData)
-		{
-			TRACE_DEBUG(INFO,"%sSession state was not been freed correctly!!!",DIAMEAP_EXTENSION);
-		}
-	}
-
-	if (diameap_sm->failedavp != NULL)
-	{
-		CHECK_FCT_DO(fd_msg_free(diameap_sm->failedavp), );
-	}
-
-	if (diameap_sm->lastReqEAPavp != NULL)
-	{
-		CHECK_FCT_DO(fd_msg_free(diameap_sm->lastReqEAPavp), );
-	}
-
-	CHECK_FCT_DO(diameap_unlink_attributes_lists(diameap_sm), );
-
-	if (diameap_sm != NULL)
-	{
+			else
+			{
+				TRACE_DEBUG(INFO,"%s[%s plugin] datafree function not available.",DIAMEAP_EXTENSION,cplugin->methodname);
+				if (diameap_sm->eap_sm.methodData != NULL)
+				{
+					free(diameap_sm->eap_sm.methodData);
+					diameap_sm->eap_sm.methodData = NULL;
+				}
+			}
+			if (diameap_sm->eap_sm.methodData)
+			{
+				TRACE_DEBUG(INFO,"%sSession state was not been freed correctly!!!",DIAMEAP_EXTENSION);
+			}
+		}
+
+		if (diameap_sm->failedavp != NULL)
+		{
+			CHECK_FCT_DO(fd_msg_free(diameap_sm->failedavp), );
+		}
+
+		if (diameap_sm->lastReqEAPavp != NULL)
+		{
+			CHECK_FCT_DO(fd_msg_free(diameap_sm->lastReqEAPavp), );
+		}
+
+		CHECK_FCT_DO(diameap_unlink_attributes_lists(diameap_sm), );
+
 		free(diameap_sm);
 		diameap_sm = NULL;
Index: extensions/app_diameap/diameap_tls.c
===================================================================
--- extensions/app_diameap/diameap_tls.c	(revision 874)
+++ extensions/app_diameap/diameap_tls.c	(revision 1151)
@@ -396,4 +396,6 @@
 	*/
 	fprintf(stderr, "-------------End Dump EAP-TLS msg-------------\n");
+	
+	free(data);
 }
 
Index: libfdproto/dispatch.c
===================================================================
--- libfdproto/dispatch.c	(revision 1127)
+++ libfdproto/dispatch.c	(revision 1151)
@@ -123,5 +123,5 @@
 	struct fd_list * cb_list = NULL;
 	struct disp_hdl * new;
-	struct dict_object * type_enum, * type_avp;
+	struct dict_object * type_enum = NULL, * type_avp;
 	struct dictionary  * dict = NULL;
 	
@@ -150,5 +150,7 @@
 			if (dict) {
 				CHECK_FCT( fd_dict_search(dict, DICT_TYPE, TYPE_OF_AVP, when->avp, &type_avp, EINVAL) );
-				CHECK_PARAMS( type_enum == type_avp );
+				if (type_enum) {
+					CHECK_PARAMS( type_enum == type_avp );
+				}
 			}
 			break;
