Index: tests/testdisp.c
===================================================================
--- tests/testdisp.c	(revision 1088)
+++ tests/testdisp.c	(revision 1113)
@@ -106,9 +106,9 @@
 	struct dict_object * avp1, * avp2; /* avp2 is enumerated; they are both unsigned32 types */
 	struct dict_object * enu1, * enu2;
-	struct msg * msg = NULL;
+	struct msg * msg = NULL, *error;
 	enum disp_action action;
 	struct disp_hdl * hdl[NB_CB];
 	struct disp_when when;
-	char * ec;
+	char * ec, *em;
 	
 	/* First, initialize the daemon modules */
@@ -156,5 +156,5 @@
 		msg = new_msg( 0, cmd1, avp1, NULL, 0 );
 		memset(cbcalled, 0, sizeof(cbcalled));
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( DISP_ACT_CONT, action );
@@ -180,5 +180,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 0, cmd1, avp1, NULL, 0 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 0, cbcalled[1] );
@@ -191,5 +191,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 1, cmd1, avp1, NULL, 0 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 1, cbcalled[1] );
@@ -202,5 +202,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 2, cmd1, avp1, NULL, 0 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 0, cbcalled[1] );
@@ -236,5 +236,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 0, cmd1, avp1, NULL, 0 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 1, cbcalled[1] );
@@ -246,5 +246,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 2, cmd1, avp1, NULL, 0 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 1, cbcalled[1] );
@@ -256,5 +256,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 2, cmd2, avp1, NULL, 0 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 0, cbcalled[1] );
@@ -266,5 +266,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 1, cmd2, NULL, avp2, 0 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 0, cbcalled[1] );
@@ -316,5 +316,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 0, cmd1, NULL, NULL, 0 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 0, cbcalled[1] );
@@ -328,5 +328,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 0, cmd1, avp1, NULL, 0 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 1, cbcalled[1] );
@@ -340,5 +340,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 1, cmd2, avp1, NULL, 0 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 1, cbcalled[1] );
@@ -352,5 +352,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 1, cmd1, avp1, NULL, 0 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 1, cbcalled[1] );
@@ -364,5 +364,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 1, cmd1, avp1, avp2, 0 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 1, cbcalled[1] );
@@ -377,5 +377,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 1, cmd1, NULL, avp2, 1 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 0, cbcalled[1] );
@@ -390,5 +390,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 1, cmd1, NULL, avp2, 2 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 0, cbcalled[1] );
@@ -437,5 +437,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 0, cmd1, avp1, NULL, 0 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 0, cbcalled[1] );
@@ -447,5 +447,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 1, cmd2, avp1, avp2, 0 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 0, cbcalled[1] );
@@ -457,5 +457,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 1, cmd2, avp1, avp2, 1 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 1, cbcalled[1] );
@@ -467,5 +467,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 1, cmd2, avp1, avp2, 2 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 0, cbcalled[1] );
@@ -477,5 +477,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 1, cmd1, avp1, avp2, 1 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 1, cbcalled[1] );
@@ -495,5 +495,5 @@
 			CHECK( 0, fd_msg_avp_add ( msg, MSG_BRW_LAST_CHILD, avp ) );
 		}
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 1, cbcalled[1] );
@@ -519,5 +519,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 1, cmd1, avp1, avp2, 1 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 1, cbcalled[1] );
@@ -526,4 +526,6 @@
 		CHECK( 0, cbcalled[3] );
 		CHECK( 0, msg ? 1 : 0);
+		CHECK( 1, ec ? 1 : 0);
+		CHECK( 0, fd_msg_free( error ) );
 		
 		CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) );
@@ -541,5 +543,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 1, cmd1, avp1, avp2, 1 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 1, cbcalled[1] );
@@ -548,4 +550,5 @@
 		CHECK( 0, cbcalled[3] );
 		CHECK( NULL, msg );
+		CHECK( NULL, ec );
 		
 		CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) );
@@ -563,5 +566,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 1, cmd1, avp1, avp2, 1 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 1, cbcalled[1] );
@@ -594,5 +597,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 2, cmd2, avp1, avp2, 2 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 1, cbcalled[1] );
@@ -606,5 +609,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 2, cmd2, avp1, avp2, 2 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 0, cbcalled[1] );
@@ -619,5 +622,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 2, cmd2, avp1, avp2, 2 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 1, cbcalled[1] );
@@ -632,5 +635,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 2, cmd2, avp1, avp2, 2 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 1, cbcalled[1] );
@@ -645,5 +648,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 2, cmd2, avp1, avp2, 2 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 1, cbcalled[1] );
@@ -658,5 +661,5 @@
 		memset(cbcalled, 0, sizeof(cbcalled));
 		msg = new_msg( 2, cmd2, avp1, avp2, 2 );
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( 1, cbcalled[1] );
@@ -711,5 +714,5 @@
 		msg = new_msg( 0, cmd1, avp1, NULL, 0 );
 		memset(cbcalled, 0, sizeof(cbcalled));
-		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec ) );
+		CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) );
 		CHECK( 1, cbcalled[0] );
 		CHECK( DISP_ACT_CONT, action );
