replace g_malloc and alike by their corresponding ep_ functions
authorulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 11 Mar 2006 09:08:18 +0000 (09:08 +0000)
committerulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 11 Mar 2006 09:08:18 +0000 (09:08 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17576 f5534014-38df-0310-8fa8-9805f1628bb7

plugins/profinet/packet-dcerpc-pn-io.c
plugins/profinet/packet-pn-dcp.c

index cd3e2316da45857005c9a221175b89114f44a183..68d24152b57543d162fb4c451279926c9feed270 100644 (file)
@@ -867,11 +867,10 @@ dissect_ARBlockReq(tvbuff_t *tvb, int offset,
        offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, 
                         hf_pn_io_station_name_length, &u16NameLength);
 
-    pu8StationName = g_malloc(u16NameLength+1);
+    pu8StationName = ep_alloc(u16NameLength+1);
     tvb_memcpy(tvb, pu8StationName, offset, u16NameLength);
     pu8StationName[u16NameLength] = '\0';
     proto_tree_add_string (tree, hf_pn_io_cminitiator_station_name, tvb, offset, u16NameLength, pu8StationName);
-    g_free(pu8StationName);
     offset += u16NameLength;
 
     /*if (check_col(pinfo->cinfo, COL_INFO))
@@ -1157,11 +1156,10 @@ dissect_MCRBlockReq(tvbuff_t *tvb, int offset,
        offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, 
                         hf_pn_io_station_name_length, &u16NameLength);
 
-    pu8StationName = g_malloc(u16NameLength+1);
+    pu8StationName = ep_alloc(u16NameLength+1);
     tvb_memcpy(tvb, pu8StationName, offset, u16NameLength);
     pu8StationName[u16NameLength] = '\0';
     proto_tree_add_string (tree, hf_pn_io_provider_station_name, tvb, offset, u16NameLength, pu8StationName);
-    g_free(pu8StationName);
     offset += u16NameLength;    
 
     return offset;
index 93c2d716a62b0137287cf2c54ae18935e02800b8..b4214f43712704c83e6591900ab4ab610e218dc8 100644 (file)
@@ -489,7 +489,7 @@ dissect_PNDCP_Suboption_Device(tvbuff_t *tvb, int offset, packet_info *pinfo,
 
     switch(suboption) {
     case(PNDCP_SUBOPTION_DEVICE_MANUF):
-        typeofstation = g_malloc(block_length+1);
+        typeofstation = ep_alloc(block_length+1);
         tvb_memcpy(tvb, typeofstation, offset, block_length);
         typeofstation[block_length] = '\0';
         proto_tree_add_string (tree, hf_pn_dcp_suboption_device_typeofstation, tvb, offset, block_length, typeofstation);
@@ -498,11 +498,10 @@ dissect_PNDCP_Suboption_Device(tvbuff_t *tvb, int offset, packet_info *pinfo,
         if(is_response)
             proto_item_append_text(block_item, ", Status: %u", status);
         proto_item_append_text(block_item, ", TypeOfStation: \"%s\"", typeofstation);
-        g_free(typeofstation);
         offset += block_length;
         break;
     case(PNDCP_SUBOPTION_DEVICE_NAMEOFSTATION):
-        nameofstation = g_malloc(block_length+1);
+        nameofstation = ep_alloc(block_length+1);
         tvb_memcpy(tvb, nameofstation, offset, block_length);
         nameofstation[block_length] = '\0';
         proto_tree_add_string (tree, hf_pn_dcp_suboption_device_nameofstation, tvb, offset, block_length, nameofstation);
@@ -511,7 +510,6 @@ dissect_PNDCP_Suboption_Device(tvbuff_t *tvb, int offset, packet_info *pinfo,
         if(is_response)
             proto_item_append_text(block_item, ", Status: %u", status);
         proto_item_append_text(block_item, ", \"%s\"", nameofstation);
-        g_free(nameofstation);
         offset += block_length;
         break;
     case(PNDCP_SUBOPTION_DEVICE_DEV_ID):
@@ -540,9 +538,8 @@ dissect_PNDCP_Suboption_Device(tvbuff_t *tvb, int offset, packet_info *pinfo,
             proto_item_append_text(block_item, ", PN-Supervisor");
         break;
     case(PNDCP_SUBOPTION_DEVICE_DEV_OPTIONS):
-        info_str = g_strdup_printf(", Dev-Options(%u)", block_length/2);
+        info_str = ep_strdup_printf(", Dev-Options(%u)", block_length/2);
         pn_append_info(pinfo, dcp_item, info_str);
-        g_free(info_str);
         proto_item_append_text(block_item, "Device/Device Options");
         if(is_response)
             proto_item_append_text(block_item, ", Status: %u", status);
@@ -659,9 +656,8 @@ dissect_PNDCP_Suboption_Control(tvbuff_t *tvb, int offset, packet_info *pinfo,
         offset = dissect_PNDCP_Option(tvb, offset, pinfo, tree, block_item, hf_pn_dcp_suboption_control_status, 
             FALSE /* append_col */);
         offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_result, &result);
-        info_str = g_strdup_printf(", Response(%s)", val_to_str(result, pn_dcp_result, "Unknown"));
+        info_str = ep_strdup_printf(", Response(%s)", val_to_str(result, pn_dcp_result, "Unknown"));
         pn_append_info(pinfo, dcp_item, info_str);
-        g_free(info_str);
         proto_item_append_text(block_item, ", Result: %s", val_to_str(result, pn_dcp_result, "Unknown"));
         break;
     default:
@@ -842,9 +838,8 @@ dissect_PNDCP_PDU(tvbuff_t *tvb,
         return;
     }
 
-    xid_str = g_strdup_printf(", Xid:0x%x", xid);
+    xid_str = ep_strdup_printf(", Xid:0x%x", xid);
     pn_append_info(pinfo, dcp_item, xid_str);
-    g_free(xid_str);
 
     /* dissect a number of blocks (depending on the remaining length) */
     while(data_length) {