aboutsummaryrefslogtreecommitdiffstats
path: root/tap.c
diff options
context:
space:
mode:
authoroabad <oabad@f5534014-38df-0310-8fa8-9805f1628bb7>2002-10-14 19:45:08 +0000
committeroabad <oabad@f5534014-38df-0310-8fa8-9805f1628bb7>2002-10-14 19:45:08 +0000
commitdccbd571ba75f3ddf811780669395a6304ed1813 (patch)
tree5767f7f234b6e1380ffb569c28c4eae03e9f30d5 /tap.c
parent75907ec933d98f1d2f3e8f0fd915ce24ae9243cf (diff)
1- We were writing 1 byte past the end of the buffer in register_tap
(bug found with valgrind) : td->name = malloc(strlen(name)); strcpy(td->name, name); Replaced with : td->name = g_strdup(name); 2 - Use g_malloc instead of malloc (both were used). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@6417 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'tap.c')
-rw-r--r--tap.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/tap.c b/tap.c
index 1efbd7a817..6624ffb634 100644
--- a/tap.c
+++ b/tap.c
@@ -1,7 +1,7 @@
/* tap.c
* packet tap interface 2002 Ronnie Sahlberg
*
- * $Id: tap.c,v 1.3 2002/09/14 07:42:52 sahlberg Exp $
+ * $Id: tap.c,v 1.4 2002/10/14 19:45:08 oabad Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -96,7 +96,7 @@ tap_init(void)
tap_packet_t *tpt;
for(i=0;i<TAP_PACKET_QUEUE_LEN;i++){
- tpt=malloc(sizeof(tap_packet_t));
+ tpt=g_malloc(sizeof(tap_packet_t));
tpt->next=tap_packet_list_free;
tap_packet_list_free=tpt;
}
@@ -133,10 +133,9 @@ register_tap(char *name)
tap_dissector_t *td, *tdl;
int i;
- td=malloc(sizeof(tap_dissector_t));
+ td=g_malloc(sizeof(tap_dissector_t));
td->next=NULL;
- td->name=malloc(strlen(name));
- strcpy(td->name, name);
+ td->name = g_strdup(name);
if(!tap_dissector_list){
tap_dissector_list=td;