summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--epan/dissectors/dcerpc/idl2wrs.c10
-rw-r--r--epan/proto.c12
-rw-r--r--tools/lemon/lemon.c2
-rw-r--r--trigcap.c4
4 files changed, 17 insertions, 11 deletions
diff --git a/epan/dissectors/dcerpc/idl2wrs.c b/epan/dissectors/dcerpc/idl2wrs.c
index bccef64a0a..2eba2b2e32 100644
--- a/epan/dissectors/dcerpc/idl2wrs.c
+++ b/epan/dissectors/dcerpc/idl2wrs.c
@@ -105,13 +105,17 @@ static char line[1024];
static void FPRINTF(FILE *fh, const char *format, ...)
{
va_list args;
- va_start(args, format);
+
#ifdef IDL2WRS_DEBUG
+ va_start(args, format);
vfprintf (stderr, format, args);
+ va_end(args);
#endif
- if (fh)
+ if (fh) {
+ va_start(args, format);
vfprintf (fh, format, args);
- va_end(args);
+ va_end(args);
+ }
}
typedef struct _pointer_item_t {
diff --git a/epan/proto.c b/epan/proto.c
index 3864ae994e..81a1a57223 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -1080,9 +1080,12 @@ proto_tree_add_debug_text(proto_tree *tree, const char *format, ...)
pi = proto_tree_add_text_node(tree, NULL, 0, 0);
- va_start(ap, format);
- if (pi)
+ if (pi) {
+ va_start(ap, format);
proto_tree_set_representation(pi, format, ap);
+ va_end(ap);
+ }
+ va_start(ap, format);
vprintf(format, ap);
va_end(ap);
printf("\n");
@@ -3634,8 +3637,6 @@ proto_item_append_text(proto_item *pi, const char *format, ...)
}
if (!PROTO_ITEM_IS_HIDDEN(pi)) {
- va_start(ap, format);
-
/*
* If we don't already have a representation,
* generate the default representation.
@@ -3647,10 +3648,11 @@ proto_item_append_text(proto_item *pi, const char *format, ...)
curlen = strlen(fi->rep->representation);
if (ITEM_LABEL_LENGTH > curlen) {
+ va_start(ap, format);
g_vsnprintf(fi->rep->representation + curlen,
ITEM_LABEL_LENGTH - (gulong) curlen, format, ap);
+ va_end(ap);
}
- va_end(ap);
}
}
diff --git a/tools/lemon/lemon.c b/tools/lemon/lemon.c
index 0facd5bdc3..26961660ef 100644
--- a/tools/lemon/lemon.c
+++ b/tools/lemon/lemon.c
@@ -1333,7 +1333,6 @@ void ErrorMsg(const char *filename, int lineno, const char *format, ...)
va_list ap;
int end, restart, base;
- va_start(ap, format);
/* Prepare a prefix to be prepended to every output line */
if( lineno>0 ){
sprintf(prefix,"%.*s:%d: ",PREFIXLIMIT-10,filename,lineno);
@@ -1344,6 +1343,7 @@ void ErrorMsg(const char *filename, int lineno, const char *format, ...)
availablewidth = LINEWIDTH - prefixsize;
/* Generate the error message */
+ va_start(ap, format);
vsprintf(errmsg,format,ap);
va_end(ap);
errmsgsize = (int) strlen(errmsg);
diff --git a/trigcap.c b/trigcap.c
index 9ecce1f8cc..394c50ad21 100644
--- a/trigcap.c
+++ b/trigcap.c
@@ -49,12 +49,12 @@ static void panic(int err, const char* fmt, ...) {
static void dprintf(int lev, const char* fmt, ...) {
va_list ap;
- va_start(ap,fmt);
if (lev <= debug_level) {
+ va_start(ap,fmt);
vfprintf(stderr,fmt,ap);
+ va_end(ap);
fflush(stderr);
}
- va_end(ap);
}