X-Git-Url: http://gitweb.fperrin.net/?p=iftop.git;a=blobdiff_plain;f=hash.c;h=1c500f16f19dbebee34ee0d8d0598e3247c90093;hp=540af8e609c083cac49f1ee224d8d854c4e270a2;hb=HEAD;hpb=cd1db5a0a5c698b647e554a003c7e48b5db695f5 diff --git a/hash.c b/hash.c index 540af8e..1c500f1 100644 --- a/hash.c +++ b/hash.c @@ -76,6 +76,11 @@ hash_status_enum hash_find(hash_type* hash_table, void* key, void **rec) { hash_status_enum hash_next_item(hash_type* hash_table, hash_node_type** ppnode) { int i; + + if (hash_table == 0) { + return HASH_STATUS_KEY_NOT_FOUND; + } + if(*ppnode != NULL) { if((*ppnode)->next != NULL) { *ppnode = (*ppnode)->next; @@ -101,6 +106,11 @@ hash_status_enum hash_next_item(hash_type* hash_table, hash_node_type** ppnode) void hash_delete_all(hash_type* hash_table) { int i; hash_node_type *n, *nn; + + if(hash_table == 0) { + return; + } + for(i = 0; i < hash_table->size; i++) { n = hash_table->table[i]; while(n != NULL) {