aboutsummaryrefslogtreecommitdiffstats
path: root/dumpcap.c
diff options
context:
space:
mode:
authorJörg Mayer <jmayer@loplof.de>2006-11-02 09:45:12 +0000
committerJörg Mayer <jmayer@loplof.de>2006-11-02 09:45:12 +0000
commit23ce819952282ef05d3fe29cf82d3ea2495065f0 (patch)
tree1544dff0eb3db3e58d4f8f254472fb9f47ec3ed3 /dumpcap.c
parent003db517095c19dab06a1871485d5e0c607b43c6 (diff)
Frederic Heem:
Fix some memleaks and overflows. I haven't committed the changes that are not bug fixes. svn path=/trunk/; revision=19777
Diffstat (limited to 'dumpcap.c')
-rw-r--r--dumpcap.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/dumpcap.c b/dumpcap.c
index 63a52ce0c6..1909a97891 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -25,6 +25,7 @@
# include "config.h"
#endif
+#include <stdlib.h> /* for exit() */
#include <glib.h>
#include <string.h>
@@ -232,8 +233,6 @@ main(int argc, char *argv[])
int opt;
extern char *optarg;
gboolean arg_error = FALSE;
- GString *comp_info_str;
- GString *runtime_info_str;
#ifdef _WIN32
WSADATA wsaData;
@@ -272,13 +271,6 @@ main(int argc, char *argv[])
SetConsoleCtrlHandler(&ConsoleCtrlHandlerRoutine, TRUE);
#endif /* _WIN32 */
- /* Assemble the compile-time version information string */
- comp_info_str = g_string_new("Compiled ");
- get_compiled_version_info(comp_info_str, NULL);
-
- /* Assemble the run-time version information string */
- runtime_info_str = g_string_new("Running ");
- get_runtime_version_info(runtime_info_str, NULL);
/* the default_log_handler will use stdout, which makes trouble in */
/* capture child mode, as it uses stdout for it's sync_pipe */
@@ -325,9 +317,22 @@ main(int argc, char *argv[])
exit_main(0);
break;
case 'v': /* Show version and exit */
+ {
+ GString *comp_info_str;
+ GString *runtime_info_str;
+ /* Assemble the compile-time version information string */
+ comp_info_str = g_string_new("Compiled with ");
+ get_compiled_version_info(comp_info_str, NULL);
+
+ /* Assemble the run-time version information string */
+ runtime_info_str = g_string_new("Running ");
+ get_runtime_version_info(runtime_info_str, NULL);
show_version(comp_info_str, runtime_info_str);
+ g_string_free(comp_info_str, TRUE);
+ g_string_free(runtime_info_str, TRUE);
exit_main(0);
break;
+ }
/*** capture option specific ***/
case 'a': /* autostop criteria */
case 'b': /* Ringbuffer option */