Changeset 1316:2e868f71832f in freeDiameter
- Timestamp:
- Dec 10, 2016, 11:12:02 PM (7 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libfdproto/dictionary.c
r1281 r1316 262 262 263 263 /* Initialize the "data" part of an object */ 264 static int init_object_data(struct dict_object * dest, void * source, enum dict_object_type type )264 static int init_object_data(struct dict_object * dest, void * source, enum dict_object_type type, int dupos) 265 265 { 266 266 TRACE_ENTRY("%p %p %d", dest, source, type); … … 287 287 case DICT_ENUMVAL: 288 288 DUP_string_len( dest->data.enumval.enum_name, &dest->datastr_len ); 289 if (dupos) { 290 // we also need to duplicate the octetstring constant value since it is a pointer. 291 dest->data.enumval.enum_value.os.data = os0dup( 292 ((struct dict_enumval_data *)source)->enum_value.os.data, 293 ((struct dict_enumval_data *)source)->enum_value.os.len 294 ); 295 } 289 296 break; 290 297 … … 1605 1612 { 1606 1613 int ret = 0; 1614 int dupos = 0; 1607 1615 struct dict_object * new = NULL; 1608 1616 struct dict_object * vendor = NULL; … … 1655 1663 CHECK_PARAMS_DO( ((struct dict_cmd_data *)data)->cmd_flag_mask & CMD_FLAG_REQUEST, goto error_param ); 1656 1664 } 1665 1666 /* For ENUMVAL object, check if the parent type is an OctetString */ 1667 if (type == DICT_ENUMVAL) { 1668 if (parent->data.type.type_base == AVP_TYPE_OCTETSTRING) 1669 dupos = 1; 1670 } 1657 1671 1658 1672 /* We have to check that the new values are not equal to the sentinels */ … … 1669 1683 /* Initialize the data of the new object */ 1670 1684 init_object(new, type); 1671 init_object_data(new, data, type );1685 init_object_data(new, data, type, dupos); 1672 1686 new->dico = dict; 1673 1687 new->parent = parent;
Note: See TracChangeset
for help on using the changeset viewer.