# HG changeset patch # User Sebastien Decugis # Date 1369230041 -7200 # Node ID 7284e41faa464fe689cd8bf9c8f2b834a5d61017 # Parent 611c5691661dfc245b98d94a2e124d22637aa50f# Parent 100a0925f80996bd448f6ee52a79ae40aafad883 Merge diff -r 611c5691661d -r 7284e41faa46 extensions/app_diameap/diameap_eap.c --- a/extensions/app_diameap/diameap_eap.c Fri May 17 11:06:33 2013 +0800 +++ b/extensions/app_diameap/diameap_eap.c Wed May 22 15:40:41 2013 +0200 @@ -91,13 +91,13 @@ TRACE_ENTRY("%p %p %p",eap_sm,eaptype,vendor); *vendor = 0; *eaptype = TYPE_NONE; - eap_sm->selectedMethod = NULL; - if (eap_sm == NULL) { return EINVAL; } + eap_sm->selectedMethod = NULL; + if (eap_sm->user.userid == NULL) { if ((eap_sm->currentMethod == TYPE_NONE)) diff -r 611c5691661d -r 7284e41faa46 extensions/app_diameap/diameap_server.c --- a/extensions/app_diameap/diameap_server.c Fri May 17 11:06:33 2013 +0800 +++ b/extensions/app_diameap/diameap_server.c Wed May 22 15:40:41 2013 +0200 @@ -1130,16 +1130,16 @@ 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){ + 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; + free(ans_attrib); + ans_attrib = NULL; } } @@ -1184,64 +1184,64 @@ static void diameap_free(struct diameap_state_machine * diameap_sm) { - 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) + if (diameap_sm != NULL) { - - struct plugin * cplugin; - if (diameap_plugin_get(diameap_sm->eap_sm.currentVendor, - diameap_sm->eap_sm.currentMethod, &cplugin)) + if (diameap_sm->eap_sm.user.userid != NULL) { - 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); + free(diameap_sm->eap_sm.user.userid); + diameap_sm->eap_sm.user.userid = NULL; } - if (cplugin->eap_method_free) + if (diameap_sm->eap_sm.user.password != NULL) { - (*cplugin->eap_method_free)(diameap_sm->eap_sm.methodData); - diameap_sm->eap_sm.methodData = NULL; + free(diameap_sm->eap_sm.user.password); + diameap_sm->eap_sm.user.password = NULL; } - else + + diameap_sm->eap_sm.selectedMethod = NULL; + + if (diameap_sm->eap_sm.methodData != NULL) { - TRACE_DEBUG(INFO,"%s[%s plugin] datafree function not available.",DIAMEAP_EXTENSION,cplugin->methodname); - 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)) { - free(diameap_sm->eap_sm.methodData); + 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); + 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), ); - - if (diameap_sm != NULL) - { + + 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; } diff -r 611c5691661d -r 7284e41faa46 extensions/app_diameap/diameap_tls.c --- a/extensions/app_diameap/diameap_tls.c Fri May 17 11:06:33 2013 +0800 +++ b/extensions/app_diameap/diameap_tls.c Wed May 22 15:40:41 2013 +0200 @@ -395,6 +395,8 @@ } */ fprintf(stderr, "-------------End Dump EAP-TLS msg-------------\n"); + + free(data); } int diameap_tls_initialize(struct tls_data * data) diff -r 611c5691661d -r 7284e41faa46 libfdproto/dispatch.c --- a/libfdproto/dispatch.c Fri May 17 11:06:33 2013 +0800 +++ b/libfdproto/dispatch.c Wed May 22 15:40:41 2013 +0200 @@ -122,7 +122,7 @@ { 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; TRACE_ENTRY("%p %d %p %p", cb, how, when, handle); @@ -149,7 +149,9 @@ CHECK_FCT( fd_dict_disp_cb(DICT_AVP, when->avp, &cb_list) ); 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;