aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-dcm.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-08-14 05:50:14 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-08-14 05:50:14 +0000
commiteb994de4cb5059e1721edd82d0a8a1a0c91785a1 (patch)
treeb87ee2b335ab939982cc4e4e382a5db95ca1144a /epan/dissectors/packet-dcm.c
parent675e61a8a44cc49a55f6e005fe407c3d7a6e454a (diff)
change a g_malloc() that was never released into ep_alloc()
this function would always leak memory when called. this fixes a memleak in dcm svn path=/trunk/; revision=15352
Diffstat (limited to 'epan/dissectors/packet-dcm.c')
-rw-r--r--epan/dissectors/packet-dcm.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/epan/dissectors/packet-dcm.c b/epan/dissectors/packet-dcm.c
index 09219fc362..a7966b2d41 100644
--- a/epan/dissectors/packet-dcm.c
+++ b/epan/dissectors/packet-dcm.c
@@ -105,6 +105,7 @@
#include <epan/emem.h>
#include <epan/strutil.h>
#include <epan/conversation.h>
+#include <epan/emem.h>
#include "packet-tcp.h"
@@ -998,7 +999,7 @@ dissect_dcm_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dcmState_t *dcm_data;
proto_tree *dcm_tree;
conversation_t *conv;
- char *buf;
+ char *buf=NULL;
int offset = 0;
if (NULL == (conv = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
@@ -1028,14 +1029,14 @@ dissect_dcm_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb_memcpy(tvb, dcm_data->orig, 10, 16);
tvb_memcpy(tvb, dcm_data->targ, 26, 16);
dcm_data->orig[AEEND] = dcm_data->targ[AEEND] = 0;
- buf = g_malloc(128);
+ buf = ep_alloc(128);
g_snprintf(buf, 128, "DCM ASSOC Request %s <-- %s",
dcm_data->orig, dcm_data->targ);
offset = 74;
break;
case 2: /* ASSOC Accept */
tvb_memcpy(tvb, dcm_data->resp, 26, 16);
- buf = g_malloc(128);
+ buf = ep_alloc(128);
g_snprintf(buf, 128, "DCM ASSOC Accept %s <-- %s (%s)",
dcm_data->orig, dcm_data->targ, dcm_data->resp);
offset = 74;
@@ -1044,7 +1045,7 @@ dissect_dcm_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dcm_data->result = tvb_get_guint8(tvb, 7);
dcm_data->source = tvb_get_guint8(tvb, 8);
dcm_data->reason = tvb_get_guint8(tvb, 9);
- buf = g_malloc(128);
+ buf = ep_alloc(128);
g_snprintf(buf, 128, "DCM ASSOC Reject %s <-- %s %s %s %s",
dcm_data->orig, dcm_data->targ,
dcm_result2str(dcm_data->result),
@@ -1054,23 +1055,23 @@ dissect_dcm_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
case 4: /* DATA */
offset = 6;
- buf = g_malloc(128);
+ buf = ep_alloc(128);
strcpy(buf, "DCM Data");
break;
case 5: /* RELEASE Request */
- buf = g_malloc(128);
+ buf = ep_alloc(128);
strcpy(buf, "DCM RELEASE Request");
offset = 6;
break;
case 6: /* RELEASE Response */
- buf = g_malloc(128);
+ buf = ep_alloc(128);
strcpy(buf, "DCM RELEASE Response");
offset = 6;
break;
case 7: /* ABORT */
dcm_data->source = tvb_get_guint8(tvb, 8);
dcm_data->reason = tvb_get_guint8(tvb, 9);
- buf = g_malloc(128);
+ buf = ep_alloc(128);
g_snprintf(buf, 128, "DCM ABORT %s <-- %s %s %s",
dcm_data->orig, dcm_data->targ,
(dcm_data->source == 1) ? "USER" :
@@ -1078,7 +1079,7 @@ dissect_dcm_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dcm_data->source == 1 ? dcm_abort2str(dcm_data->reason) : "");
break;
default:
- buf = g_malloc(128);
+ buf = ep_alloc(128);
strcpy(buf, "DCM Continuation");
offset = -1; /* cannot continue parsing */
break;