aboutsummaryrefslogtreecommitdiffstats
path: root/extcap.c
diff options
context:
space:
mode:
authorJohn Thacker <johnthacker@gmail.com>2023-12-16 10:12:48 -0500
committerJohn Thacker <johnthacker@gmail.com>2023-12-16 11:06:36 -0500
commit63840f1cfb8af102c92e420a64efd0ccac5c553e (patch)
treefe3ecdbcc8000baa7a6b2b990a56e9ffd6a3563a /extcap.c
parent636f0a989a20fd155322004674fe788875c0a679 (diff)
extcap: Fix Coverity 1559270
Check to see if the return pointer is non NULL
Diffstat (limited to 'extcap.c')
-rw-r--r--extcap.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/extcap.c b/extcap.c
index 0e29b095a6..d6a4f20c37 100644
--- a/extcap.c
+++ b/extcap.c
@@ -566,7 +566,7 @@ static gboolean cb_dlt(extcap_callback_info_t cb_info)
}
/* Check to see if we built a list */
- if (linktype_list != NULL && cb_info.data != NULL)
+ if (linktype_list != NULL)
{
caps->data_link_types = linktype_list;
}
@@ -579,7 +579,20 @@ static gboolean cb_dlt(extcap_callback_info_t cb_info)
*(cb_info.err_str) = g_strdup(caps->primary_msg);
}
}
- *(if_capabilities_t **) cb_info.data = caps;
+ if (cb_info.data != NULL)
+ {
+ *(if_capabilities_t **) cb_info.data = caps;
+ } else
+ {
+#ifdef HAVE_LIBPCAP
+ free_if_capabilities(caps);
+#else
+ /* TODO: free_if_capabilities is in capture-pcap-util.c and doesn't
+ * get defined unless HAVE_LIBPCAP is set.
+ */
+ g_free(caps);
+#endif
+ }
extcap_free_dlts(temp);