diff options
author | John Thacker <johnthacker@gmail.com> | 2023-12-16 10:12:48 -0500 |
---|---|---|
committer | John Thacker <johnthacker@gmail.com> | 2023-12-16 11:06:36 -0500 |
commit | 63840f1cfb8af102c92e420a64efd0ccac5c553e (patch) | |
tree | fe3ecdbcc8000baa7a6b2b990a56e9ffd6a3563a | |
parent | 636f0a989a20fd155322004674fe788875c0a679 (diff) |
extcap: Fix Coverity 1559270
Check to see if the return pointer is non NULL
-rw-r--r-- | extcap.c | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -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); |