diff options
author | Luis Ontanon <luis.ontanon@gmail.com> | 2005-03-01 23:46:05 +0000 |
---|---|---|
committer | Luis Ontanon <luis.ontanon@gmail.com> | 2005-03-01 23:46:05 +0000 |
commit | 779a8f5d80ce376277b80de3891bf115015ca33a (patch) | |
tree | f5e651124d02ec33c619716a381886630be31b58 /tethereal.c | |
parent | 95c0c2831dd66a60bcb2f750b41694147b3a4a6d (diff) |
If -z was not given as the very last argument the tap listener initialization might have crashed.
Copy the optarg so that when the tap initialization is called it gets the right argument.
svn path=/trunk/; revision=13570
Diffstat (limited to 'tethereal.c')
-rw-r--r-- | tethereal.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tethereal.c b/tethereal.c index e7b522ae51..3d05d1a386 100644 --- a/tethereal.c +++ b/tethereal.c @@ -682,7 +682,7 @@ main(int argc, char *argv[]) e_prefs *prefs; char badopt; ethereal_tap_list *tli = NULL; - gboolean got_tap = FALSE; + guint8* tli_optarg = NULL; #ifdef HAVE_LIBPCAP capture_opts_init(&capture_opts, NULL /* cfile */); @@ -1050,7 +1050,7 @@ main(int argc, char *argv[]) as it would disallow mate's fields (which are registered by the preferences set callback) from being used as part of a tap filter */ - got_tap = TRUE; + tli_optarg = g_strdup(optarg); break; } } @@ -1240,8 +1240,10 @@ main(int argc, char *argv[]) /* At this point mate will have registered its field array so we can have a filter with one of mate's late registered fields as part of the tap's filter */ - if (got_tap) - (*tli->func)(optarg); + if (tli_optarg != NULL) { + (*tli->func)(tli_optarg); + g_free(tli_optarg); + } /* disabled protocols as per configuration file */ if (gdp_path == NULL && dp_path == NULL) { |