diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-05-04 10:55:35 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-05-04 10:55:35 -0700 |
commit | cd46a74cf49299d92640bfe63b4caf66e0cce65c (patch) | |
tree | e9f5a9cab42c1b5c541590efa5d74533101bb039 /pcap-snf.c | |
parent | 30b93db53bd0d07fa9151af01eadf41c4fbc4ae2 (diff) |
Use pcap_close() if pcap_create_handle() fails.
Use it to free up all memory attached to the pcap_t, as well as the
pcap_t itself; that closes some memory leaks.
Fixes GitHub issue #432.
Diffstat (limited to 'pcap-snf.c')
-rw-r--r-- | pcap-snf.c | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -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; |