Index: libfdproto/dispatch.c
===================================================================
--- libfdproto/dispatch.c	(revision 1078)
+++ libfdproto/dispatch.c	(revision 1113)
@@ -68,5 +68,6 @@
 /* Call CBs from a given list (any_handlers if cb_list is NULL) -- must have locked fd_disp_lock before */
 int fd_disp_call_cb_int( struct fd_list * cb_list, struct msg ** msg, struct avp *avp, struct session *sess, enum disp_action *action, 
-			struct dict_object * obj_app, struct dict_object * obj_cmd, struct dict_object * obj_avp, struct dict_object * obj_enu)
+			struct dict_object * obj_app, struct dict_object * obj_cmd, struct dict_object * obj_avp, struct dict_object * obj_enu,
+			char ** drop_reason, struct msg ** drop_msg)
 {
 	struct fd_list * senti, *li;
@@ -97,6 +98,6 @@
 		CHECK_FCT_DO( (r = (*hdl->cb)(msg, avp, sess, hdl->opaque, action)),
 			{
-				//fd_msg_log( FD_MSG_LOG_DROPPED, *msg, "Internal error: a DISPATCH callback returned an error (%s)", strerror(r));
-				fd_msg_free(*msg);
+				*drop_reason = "Internal error: a DISPATCH callback returned an error";
+				*drop_msg = *msg;
 				*msg = NULL;
 			}
Index: libfdproto/fdproto-internal.h
===================================================================
--- libfdproto/fdproto-internal.h	(revision 1088)
+++ libfdproto/fdproto-internal.h	(revision 1113)
@@ -55,5 +55,6 @@
 DECLARE_FD_DUMP_PROTOTYPE(fd_dict_dump_avp_value, union avp_value *avp_value, struct dict_object * model, int indent, int header);
 int fd_disp_call_cb_int( struct fd_list * cb_list, struct msg ** msg, struct avp *avp, struct session *sess, enum disp_action *action, 
-			struct dict_object * obj_app, struct dict_object * obj_cmd, struct dict_object * obj_avp, struct dict_object * obj_enu);
+			struct dict_object * obj_app, struct dict_object * obj_cmd, struct dict_object * obj_avp, struct dict_object * obj_enu,
+			char ** drop_reason, struct msg ** drop_msg);
 extern pthread_rwlock_t fd_disp_lock;
 
Index: libfdproto/messages.c
===================================================================
--- libfdproto/messages.c	(revision 1103)
+++ libfdproto/messages.c	(revision 1113)
@@ -2670,5 +2670,5 @@
 
 /* Call all dispatch callbacks for a given message */
-int fd_msg_dispatch ( struct msg ** msg, struct session * session, enum disp_action *action, char ** error_code)
+int fd_msg_dispatch ( struct msg ** msg, struct session * session, enum disp_action *action, char ** error_code, char ** drop_reason, struct msg ** drop_msg)
 {
 	struct dictionary  * dict;
@@ -2684,4 +2684,6 @@
 	if (error_code)
 		*error_code = NULL;
+	if (drop_reason)
+		*drop_reason = NULL;
 	*action = DISP_ACT_CONT;
 	
@@ -2691,5 +2693,5 @@
 	
 	/* First, call the DISP_HOW_ANY callbacks */
-	CHECK_FCT_DO( ret = fd_disp_call_cb_int( NULL, msg, NULL, session, action, NULL, NULL, NULL, NULL ), goto out );
+	CHECK_FCT_DO( ret = fd_disp_call_cb_int( NULL, msg, NULL, session, action, NULL, NULL, NULL, NULL, drop_reason, drop_msg ), goto out );
 
 	TEST_ACTION_STOP();
@@ -2708,6 +2710,6 @@
 			*action = DISP_ACT_ERROR;
 		} else {
-			//fd_msg_log( FD_MSG_LOG_DROPPED, *msg, "Internal error: Received this answer to a local query with an unsupported application %d", (*msg)->msg_public.msg_appl);
-			fd_msg_free(*msg);
+			*drop_reason = "Internal error: Received this answer to a local query with an unsupported application";
+			*drop_msg = *msg;
 			*msg = NULL;
 		}
@@ -2740,5 +2742,5 @@
 			
 			/* Call the callbacks */
-			CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, avp, session, action, app, cmd, avp->avp_model, enumval ), goto out );
+			CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, avp, session, action, app, cmd, avp->avp_model, enumval, drop_reason, drop_msg ), goto out );
 			TEST_ACTION_STOP();
 		}
@@ -2749,10 +2751,10 @@
 	/* Now call command and application callbacks */
 	CHECK_FCT_DO( ret = fd_dict_disp_cb(DICT_COMMAND, cmd, &cb_list), goto out );
-	CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, NULL, session, action, app, cmd, NULL, NULL ), goto out );
+	CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, NULL, session, action, app, cmd, NULL, NULL, drop_reason, drop_msg ), goto out );
 	TEST_ACTION_STOP();
 	
 	if (app) {
 		CHECK_FCT_DO( ret = fd_dict_disp_cb(DICT_APPLICATION, app, &cb_list), goto out );
-		CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, NULL, session, action, app, cmd, NULL, NULL ), goto out );
+		CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, NULL, session, action, app, cmd, NULL, NULL, drop_reason, drop_msg ), goto out );
 		TEST_ACTION_STOP();
 	}
