summaryrefslogtreecommitdiff
path: root/lib/hash.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-07-12 08:27:24 -0400
committerGitHub <noreply@github.com>2017-07-12 08:27:24 -0400
commit991ae35b176208e946558f97ed9ab947e832e17c (patch)
tree152b33ead5af6c1313d385571c3dc98a0e440db9 /lib/hash.c
parente88500859aa6eeb84fd8ec36d30407bc169ac2f3 (diff)
parent45082064cbc498a1f4287f411512a8183f0065d6 (diff)
Merge pull request #793 from opensourcerouting/hash-double-init
lib: init & cleanup fixes
Diffstat (limited to 'lib/hash.c')
-rw-r--r--lib/hash.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/hash.c b/lib/hash.c
index 95643bbae0..62a39953c6 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -428,6 +428,13 @@ DEFUN(show_hash_stats,
long double ssq; // ssq casted to long double
pthread_mutex_lock (&_hashes_mtx);
+ if (!_hashes)
+ {
+ pthread_mutex_unlock (&_hashes_mtx);
+ vty_outln (vty, "No hash tables in use.");
+ return CMD_SUCCESS;
+ }
+
for (ALL_LIST_ELEMENTS_RO (_hashes, ln, h))
{
if (!h->name)
@@ -482,6 +489,5 @@ DEFUN(show_hash_stats,
void
hash_cmd_init ()
{
- _hashes = list_new();
install_element (ENABLE_NODE, &show_hash_stats_cmd);
}