Changeset 1230:e72c9dad62ac in freeDiameter
- Timestamp:
- Jul 21, 2013, 6:57:39 PM (11 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
include/freeDiameter/libfdproto.h
r1213 r1230 2699 2699 char * pei_errcode; /* name of the error code to use */ 2700 2700 struct avp * pei_avp; /* pointer to invalid (in original message) or missing AVP (to be freed) */ 2701 int pei_avp_free; /* Set to 1 if the pei_avp must be freed */ 2701 2702 char * pei_message; /* Overwrite default message if needed */ 2702 2703 int pei_protoerr; /* do we set the 'E' bit in the error message ? */ -
libfdcore/messages.c
r1228 r1230 388 388 /* Set the error code */ 389 389 CHECK_FCT( fd_msg_rescode_set(m, pei.pei_errcode, pei.pei_message, pei.pei_avp, 1 ) ); 390 391 /* free the pei AVP to avoid memory leak */ 392 if (pei.pei_avp_free) { 393 fd_msg_free(pei.pei_avp); 394 } 390 395 391 396 *msg = NULL; -
libfdcore/p_ce.c
r1191 r1230 637 637 CHECK_FCT_DO( fd_out_send(cer, *recv_cnx, NULL), goto destroy ); 638 638 639 if (error->pei_avp_free) { 640 fd_msg_free(error->pei_avp); 641 } 642 639 643 /* And now destroy this connection */ 640 644 destroy: -
libfdcore/routing_dispatch.c
r1216 r1230 610 610 fd_hook_call(HOOK_MESSAGE_PARSING_ERROR, msgptr, NULL, error_info.pei_message ?: error_info.pei_errcode, fd_msg_pmdl_get(msgptr)); 611 611 CHECK_FCT( return_error( &msgptr, error_info.pei_errcode, error_info.pei_message, error_info.pei_avp) ); 612 if (error_info.pei_avp_free) { fd_msg_free(error_info.pei_avp); } 612 613 return 0; 613 614 } else { … … 632 633 fd_hook_call(HOOK_MESSAGE_PARSING_ERROR, msgptr, NULL, error_info.pei_message ?: error_info.pei_errcode, fd_msg_pmdl_get(msgptr)); 633 634 CHECK_FCT( return_error( &msgptr, error_info.pei_errcode, error_info.pei_message, error_info.pei_avp) ); 635 if (error_info.pei_avp_free) { fd_msg_free(error_info.pei_avp); } 634 636 return 0; 635 637 } else { … … 656 658 fd_hook_call(HOOK_MESSAGE_PARSING_ERROR, msgptr, NULL, error_info.pei_message ?: error_info.pei_errcode, fd_msg_pmdl_get(msgptr)); 657 659 CHECK_FCT( return_error( &msgptr, error_info.pei_errcode, error_info.pei_message, error_info.pei_avp) ); 660 if (error_info.pei_avp_free) { fd_msg_free(error_info.pei_avp); } 658 661 return 0; 659 662 } else { … … 674 677 fd_hook_call(HOOK_MESSAGE_PARSING_ERROR, msgptr, NULL, error_info.pei_message ?: error_info.pei_errcode, fd_msg_pmdl_get(msgptr)); 675 678 CHECK_FCT( return_error( &msgptr, error_info.pei_errcode, error_info.pei_message, error_info.pei_avp) ); 679 if (error_info.pei_avp_free) { fd_msg_free(error_info.pei_avp); } 676 680 return 0; 677 681 } else { … … 932 936 if (error_info.pei_errcode) { 933 937 CHECK_FCT( return_error( &msgptr, error_info.pei_errcode, error_info.pei_message, error_info.pei_avp) ); 938 if (error_info.pei_avp_free) { fd_msg_free(error_info.pei_avp); } 934 939 return 0; 935 940 } else { -
libfdproto/messages.c
r1229 r1230 2371 2371 CHECK_FCT_DO( fd_dict_getval(model_avp, &avp_info), return NULL ); 2372 2372 2373 /* Set an initial size */ 2374 avp->avp_public.avp_len = GETAVPHDRSZ( avp->avp_public.avp_flags ) + avp_value_sizes[avp_info.avp_basetype]; 2375 2373 2376 /* Prepare the empty value */ 2374 2377 memset(&val, 0, sizeof(val)); … … 2377 2380 val.os.data = os; 2378 2381 val.os.len = sizeof(os); 2382 avp->avp_public.avp_len += val.os.len; 2379 2383 case AVP_TYPE_INTEGER32: 2380 2384 case AVP_TYPE_INTEGER64: … … 2440 2444 pr_data->pei->pei_errcode = "DIAMETER_MISSING_AVP"; 2441 2445 pr_data->pei->pei_avp = empty_avp(rule->rule_avp); 2446 pr_data->pei->pei_avp_free = 1; 2442 2447 } 2443 2448 return EBADMSG; … … 2453 2458 pr_data->pei->pei_errcode = "DIAMETER_AVP_OCCURS_TOO_MANY_TIMES"; 2454 2459 pr_data->pei->pei_avp = empty_avp(rule->rule_avp); /* Well we are supposed to return the (max + 1)th instance of the AVP instead... Pfff... */ TODO("Improve..."); 2460 pr_data->pei->pei_avp_free = 1; 2455 2461 } 2456 2462 return EBADMSG; … … 2472 2478 pr_data->pei->pei_message = "AVP was not in its fixed position"; 2473 2479 pr_data->pei->pei_avp = empty_avp(rule->rule_avp); 2480 pr_data->pei->pei_avp_free = 1; 2474 2481 } 2475 2482 return EBADMSG; … … 2485 2492 pr_data->pei->pei_message = "AVP was not in its fixed position"; 2486 2493 pr_data->pei->pei_avp = empty_avp(rule->rule_avp); 2494 pr_data->pei->pei_avp_free = 1; 2487 2495 } 2488 2496 return EBADMSG;
Note: See TracChangeset
for help on using the changeset viewer.