aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pcap-dag.c4
-rw-r--r--pcap-linux.c6
-rw-r--r--pcap-snf.c4
3 files changed, 4 insertions, 10 deletions
diff --git a/pcap-dag.c b/pcap-dag.c
index 49152489..a363c4cc 100644
--- a/pcap-dag.c
+++ b/pcap-dag.c
@@ -950,9 +950,7 @@ pcap_t *dag_create(const char *device, char *ebuf, int *is_ours)
if (p->tstamp_precision_list == NULL) {
snprintf(ebuf, PCAP_ERRBUF_SIZE, "malloc: %s",
pcap_strerror(errno));
- if (p->tstamp_type_list != NULL)
- free(p->tstamp_type_list);
- free(p);
+ pcap_close(p);
return NULL;
}
p->tstamp_precision_list[0] = PCAP_TSTAMP_PRECISION_MICRO;
diff --git a/pcap-linux.c b/pcap-linux.c
index a226da12..bb4619bb 100644
--- a/pcap-linux.c
+++ b/pcap-linux.c
@@ -459,7 +459,7 @@ pcap_create_interface(const char *device, char *ebuf)
* See what time stamp types we support.
*/
if (iface_ethtool_get_ts_info(handle, ebuf) == -1) {
- free(handle);
+ pcap_close(handle);
return NULL;
}
#endif
@@ -478,9 +478,7 @@ pcap_create_interface(const char *device, char *ebuf)
if (handle->tstamp_precision_list == NULL) {
snprintf(ebuf, PCAP_ERRBUF_SIZE, "malloc: %s",
pcap_strerror(errno));
- if (handle->tstamp_type_list != NULL)
- free(handle->tstamp_type_list);
- free(handle);
+ pcap_close(handle);
return NULL;
}
handle->tstamp_precision_list[0] = PCAP_TSTAMP_PRECISION_MICRO;
diff --git a/pcap-snf.c b/pcap-snf.c
index 03dc08de..bfa0990e 100644
--- a/pcap-snf.c
+++ b/pcap-snf.c
@@ -483,9 +483,7 @@ snf_create(const char *device, char *ebuf, int *is_ours)
if (p->tstamp_precision_list == NULL) {
snprintf(ebuf, PCAP_ERRBUF_SIZE, "malloc: %s",
pcap_strerror(errno));
- if (p->tstamp_type_list != NULL)
- free(p->tstamp_type_list);
- free(p);
+ pcap_close(p);
return NULL;
}
p->tstamp_precision_list[0] = PCAP_TSTAMP_PRECISION_MICRO;