aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tap-icmpstat.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tap-icmpstat.c b/tap-icmpstat.c
index 7b586cc558..e525f01d52 100644
--- a/tap-icmpstat.c
+++ b/tap-icmpstat.c
@@ -272,12 +272,14 @@ icmpstat_init(const char *optarg, void* userdata _U_)
if (strstr(optarg, "icmp,srt,"))
filter = optarg + strlen("icmp,srt,");
- icmpstat = g_malloc0(sizeof(icmpstat_t));
- icmpstat->min_msecs = 1.0 * G_MAXUINT;
+ icmpstat = g_try_malloc0(sizeof(icmpstat_t));
if (icmpstat == NULL) {
fprintf(stderr, "tshark: g_malloc() fatal error.\n");
exit(1);
}
+
+ icmpstat->min_msecs = 1.0 * G_MAXUINT;
+
if (filter)
icmpstat->filter = g_strdup(filter);