Ensure eth_hashtable exists when doing a lookup. Not sure I'm running into the same situation as Jeff (http://www.wireshark.org/lists/wireshark-dev/201308/msg00012.html), but tshark is complaining so I can't do fuzz-testing.

Also corrected copy/pasteo when cleaning up eth_hashtable.

svn path=/trunk/; revision=51133
This commit is contained in:
Michael Mann 2013-08-04 10:22:10 +00:00
parent d3470e7d2a
commit 14dd5e8e34
1 changed files with 11 additions and 3 deletions

View File

@ -1672,6 +1672,10 @@ add_eth_name(const guint8 *addr, const gchar *name)
key = (gint64 *)g_new(gint64, 1);
*key = eth_as_int64;
if(eth_hashtable == NULL){
eth_hashtable = g_hash_table_new_full(g_int64_hash, g_int64_equal, g_free, g_free);
}
tp = (hashether_t *)g_hash_table_lookup(eth_hashtable, key);
if( tp == NULL ){
@ -1711,6 +1715,10 @@ eth_name_lookup(const guint8 *addr, const gboolean resolve) {
key = (gint64 *)g_new(gint64, 1);
*key = eth_as_int64;
if(eth_hashtable == NULL){
eth_hashtable = g_hash_table_new_full(g_int64_hash, g_int64_equal, g_free, g_free);
}
tp = (hashether_t *)g_hash_table_lookup(eth_hashtable, key);
if( tp == NULL ) {
tp = eth_hash_new_entry(addr, resolve);
@ -2713,16 +2721,16 @@ eth_name_lookup_cleanup(void) {
/* XXX this is only needed when shuting down application (if at all) */
if(manuf_hashtable){
g_hash_table_destroy(manuf_hashtable);
manuf_hashtable = NULL;
manuf_hashtable = NULL;
}
if(wka_hashtable){
g_hash_table_destroy(wka_hashtable);
wka_hashtable = NULL;
wka_hashtable = NULL;
}
if(eth_hashtable){
g_hash_table_destroy(eth_hashtable);
wka_hashtable = NULL;
eth_hashtable = NULL;
}
eth_resolution_initialized = FALSE;