aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2005-09-28 16:16:37 +0000
committerGuy Harris <guy@alum.mit.edu>2005-09-28 16:16:37 +0000
commitf6ef22c553bea7cfbdc19460d3cc720470b1c7cd (patch)
tree4e08a5b99702220fe50cd42f9c05cf1228acae04
parente2d774be167d2ff4d2759c5218b49def4ba7e265 (diff)
Have show_exception() take a "const char *" as its exception message,
and not free the string to which it points. Pass to REPORT_DISSECTOR_BUG() strings allocated with ep_strdup_printf(), so that they're freed automatically. svn path=/trunk/; revision=16039
-rw-r--r--epan/dissectors/ncp2222.py1
-rw-r--r--epan/dissectors/packet-bssgp.c1
-rw-r--r--epan/dissectors/packet-dcom.c1
-rw-r--r--epan/dissectors/packet-esis.c1
-rw-r--r--epan/dissectors/packet-frame.c4
-rw-r--r--epan/dissectors/packet-frame.h2
-rw-r--r--epan/dissectors/packet-gsm_sms_ud.c1
-rw-r--r--epan/dissectors/packet-msdp.c1
-rw-r--r--epan/dissectors/packet-pim.c1
-rw-r--r--epan/dissectors/packet-ppp.c1
-rw-r--r--epan/dissectors/packet-pppoe.c1
-rw-r--r--epan/dissectors/packet-smb-pipe.c1
-rw-r--r--epan/dissectors/packet-sna.c1
-rw-r--r--epan/dissectors/packet-udp.c1
-rw-r--r--epan/ftypes/ftype-string.c1
-rw-r--r--epan/proto.c6
-rw-r--r--epan/proto.h8
17 files changed, 22 insertions, 11 deletions
diff --git a/epan/dissectors/ncp2222.py b/epan/dissectors/ncp2222.py
index 0b285e8544..76fc22179f 100644
--- a/epan/dissectors/ncp2222.py
+++ b/epan/dissectors/ncp2222.py
@@ -5560,6 +5560,7 @@ def produce_code():
#include <epan/packet.h>
#include <epan/conversation.h>
#include <epan/ptvcursor.h>
+#include <epan/emem.h>
#include "packet-ncp-int.h"
#include "packet-ncp-nmas.h"
#include <epan/strutil.h>
diff --git a/epan/dissectors/packet-bssgp.c b/epan/dissectors/packet-bssgp.c
index 7505215ccc..c0976e8356 100644
--- a/epan/dissectors/packet-bssgp.c
+++ b/epan/dissectors/packet-bssgp.c
@@ -35,6 +35,7 @@
#include <math.h>
#include <glib.h>
#include <epan/packet.h>
+#include <epan/emem.h>
#include <prefs.h>
/*#define BSSGP_DEBUG*/
diff --git a/epan/dissectors/packet-dcom.c b/epan/dissectors/packet-dcom.c
index 2272bebed6..70600ce40d 100644
--- a/epan/dissectors/packet-dcom.c
+++ b/epan/dissectors/packet-dcom.c
@@ -84,6 +84,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <epan/emem.h>
#include "packet-dcerpc.h"
#include "packet-dcom.h"
#include "prefs.h"
diff --git a/epan/dissectors/packet-esis.c b/epan/dissectors/packet-esis.c
index b4f4c15d63..5e249ec5a0 100644
--- a/epan/dissectors/packet-esis.c
+++ b/epan/dissectors/packet-esis.c
@@ -32,6 +32,7 @@
#include <string.h>
#include <glib.h>
#include <epan/packet.h>
+#include <epan/emem.h>
#include <epan/nlpid.h>
#include "packet-osi.h"
#include "packet-osi-options.h"
diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c
index c91ff5519d..74a8769c54 100644
--- a/epan/dissectors/packet-frame.c
+++ b/epan/dissectors/packet-frame.c
@@ -261,7 +261,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
void
show_exception(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
- unsigned long exception, char *exception_message)
+ unsigned long exception, const char *exception_message)
{
static const char dissector_error_nomsg[] =
"Dissector writer didn't bother saying what the error was";
@@ -306,8 +306,6 @@ show_exception(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
"%s",
exception_message == NULL ?
dissector_error_nomsg : exception_message);
- if (exception_message != NULL)
- g_free(exception_message);
break;
default:
diff --git a/epan/dissectors/packet-frame.h b/epan/dissectors/packet-frame.h
index c604395486..1430fb1544 100644
--- a/epan/dissectors/packet-frame.h
+++ b/epan/dissectors/packet-frame.h
@@ -27,7 +27,7 @@
* Routine used to add an indication of an arbitrary exception to the tree.
*/
void show_exception(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
- unsigned long exception, char *exception_message);
+ unsigned long exception, const char *exception_message);
/*
* Routine used to add an indication of a ReportedBoundsError exception
diff --git a/epan/dissectors/packet-gsm_sms_ud.c b/epan/dissectors/packet-gsm_sms_ud.c
index 138baa4b65..b36f588d96 100644
--- a/epan/dissectors/packet-gsm_sms_ud.c
+++ b/epan/dissectors/packet-gsm_sms_ud.c
@@ -70,6 +70,7 @@
#include <epan/packet.h>
#include <epan/prefs.h>
+#include <epan/emem.h>
#include <epan/reassemble.h>
static void dissect_gsm_sms_ud(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
diff --git a/epan/dissectors/packet-msdp.c b/epan/dissectors/packet-msdp.c
index 88838ca09e..83a4ea7f04 100644
--- a/epan/dissectors/packet-msdp.c
+++ b/epan/dissectors/packet-msdp.c
@@ -36,6 +36,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <epan/emem.h>
/* MSDP message types. The messages are TLV (Type-Length-Value) encoded */
enum { MSDP_SA = 1,
diff --git a/epan/dissectors/packet-pim.c b/epan/dissectors/packet-pim.c
index 7e93e8e6e8..23f52f6b04 100644
--- a/epan/dissectors/packet-pim.c
+++ b/epan/dissectors/packet-pim.c
@@ -32,6 +32,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <epan/emem.h>
#include <epan/ipproto.h>
#include <epan/afn.h>
#include "packet-ipv6.h"
diff --git a/epan/dissectors/packet-ppp.c b/epan/dissectors/packet-ppp.c
index bc9c1a317f..199f3b5eb1 100644
--- a/epan/dissectors/packet-ppp.c
+++ b/epan/dissectors/packet-ppp.c
@@ -33,6 +33,7 @@
#include <glib.h>
#include <epan/prefs.h>
#include <epan/packet.h>
+#include <epan/emem.h>
#include "packet-ppp.h"
#include <epan/ppptypes.h>
#include <epan/etypes.h>
diff --git a/epan/dissectors/packet-pppoe.c b/epan/dissectors/packet-pppoe.c
index 3b6870cc72..666cb5ec44 100644
--- a/epan/dissectors/packet-pppoe.c
+++ b/epan/dissectors/packet-pppoe.c
@@ -28,6 +28,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <epan/emem.h>
#include <epan/strutil.h>
#include <epan/etypes.h>
diff --git a/epan/dissectors/packet-smb-pipe.c b/epan/dissectors/packet-smb-pipe.c
index d7a3d36cf0..e1276d6482 100644
--- a/epan/dissectors/packet-smb-pipe.c
+++ b/epan/dissectors/packet-smb-pipe.c
@@ -42,6 +42,7 @@ XXX Fixme : shouldnt show [malformed frame] for long packets
#include <glib.h>
#include <ctype.h>
#include <epan/packet.h>
+#include <epan/emem.h>
#include <epan/dissectors/packet-smb.h>
#include "packet-smb-pipe.h"
#include "packet-smb-browse.h"
diff --git a/epan/dissectors/packet-sna.c b/epan/dissectors/packet-sna.c
index f4a690d554..e340a9d5b9 100644
--- a/epan/dissectors/packet-sna.c
+++ b/epan/dissectors/packet-sna.c
@@ -30,6 +30,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <epan/emem.h>
#include <epan/llcsaps.h>
#include <epan/ppptypes.h>
#include <epan/sna-utils.h>
diff --git a/epan/dissectors/packet-udp.c b/epan/dissectors/packet-udp.c
index 98be190a26..9b1569e04d 100644
--- a/epan/dissectors/packet-udp.c
+++ b/epan/dissectors/packet-udp.c
@@ -35,6 +35,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <epan/emem.h>
#include <epan/addr_resolv.h>
#include <epan/ipproto.h>
#include <epan/in_cksum.h>
diff --git a/epan/ftypes/ftype-string.c b/epan/ftypes/ftype-string.c
index d4d34a6cbc..2dfdc510c3 100644
--- a/epan/ftypes/ftype-string.c
+++ b/epan/ftypes/ftype-string.c
@@ -26,6 +26,7 @@
#include <ftypes-int.h>
#include <string.h>
+#include <epan/emem.h>
#ifdef HAVE_LIBPCRE
#include <pcre.h>
diff --git a/epan/proto.c b/epan/proto.c
index 851e6b623f..3ed1e0afc3 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -2142,10 +2142,10 @@ proto_tree_add_node(proto_tree *tree, field_info *fi)
tnode = tree;
tfi = tnode->finfo;
if (tfi != NULL && (tfi->tree_type < 0 || tfi->tree_type >= num_tree_types)) {
- REPORT_DISSECTOR_BUG(g_strdup_printf("\"%s\" - \"%s\" tfi->tree_type: %u invalid (%s:%u)",
+ REPORT_DISSECTOR_BUG(ep_strdup_printf("\"%s\" - \"%s\" tfi->tree_type: %u invalid (%s:%u)",
fi->hfinfo->name, fi->hfinfo->abbrev, tfi->tree_type, __FILE__, __LINE__));
- /* XXX - is it safe to continue here? */
- }
+ /* XXX - is it safe to continue here? */
+ }
DISSECTOR_ASSERT(tfi == NULL ||
(tfi->tree_type >= 0 && tfi->tree_type < num_tree_types));
diff --git a/epan/proto.h b/epan/proto.h
index ce2a2b0cc1..7962fd0a50 100644
--- a/epan/proto.h
+++ b/epan/proto.h
@@ -84,8 +84,8 @@ typedef struct _protocol protocol_t;
* as the message for the exception, so that it can show up in
* the Info column and the protocol tree.
*
- * That string should be allocated with g_malloc(); using
- * "g_strdup_printf()" would work.
+ * If that string is dynamically allocated, it should be allocated with
+ * ep_alloc(); using ep_strdup_printf() would work.
*
* If the ETHEREAL_ABORT_ON_DISSECTOR_BUG environment variable is set,
* it will call abort(), instead, to make it easier to get a stack trace.
@@ -119,14 +119,14 @@ typedef struct _protocol protocol_t;
*/
#define DISSECTOR_ASSERT_NOT_REACHED() \
(REPORT_DISSECTOR_BUG( \
- g_strdup_printf("%s:%u: failed assertion \"DISSECTOR_ASSERT_NOT_REACHED\"", \
+ ep_strdup_printf("%s:%u: failed assertion \"DISSECTOR_ASSERT_NOT_REACHED\"", \
__FILE__, __LINE__)))
#define __DISSECTOR_ASSERT_STRINGIFY(s) # s
#define __DISSECTOR_ASSERT(expression, file, lineno) \
(REPORT_DISSECTOR_BUG( \
- g_strdup_printf("%s:%u: failed assertion \"%s\"", \
+ ep_strdup_printf("%s:%u: failed assertion \"%s\"", \
file, lineno, __DISSECTOR_ASSERT_STRINGIFY(expression))))
/** radix for decimal values, used in header_field_info.display */