From ac8415c24ffea645105c3859e814843e81c97f8a Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 16 Jan 2017 16:27:22 -0800 Subject: Start of event framework. This compiles correctly, but doesn't actually deliver events yet. As part of this, I've made most of the initializables in nng safe to tear-down if uninitialized (or set to zero e.g. via calloc). This makes it loads easier to write the teardown on error code, since I can deinit everything, without worrying about which things have been initialized and which have not. --- src/core/idhash.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/core/idhash.c') diff --git a/src/core/idhash.c b/src/core/idhash.c index d816ddf4..e541ef36 100644 --- a/src/core/idhash.c +++ b/src/core/idhash.c @@ -55,8 +55,10 @@ nni_idhash_create(nni_idhash **hp) void nni_idhash_destroy(nni_idhash *h) { - nni_free(h->ih_entries, h->ih_cap * sizeof (nni_idhash_entry)); - NNI_FREE_STRUCT(h); + if (h != NULL) { + nni_free(h->ih_entries, h->ih_cap * sizeof (nni_idhash_entry)); + NNI_FREE_STRUCT(h); + } } -- cgit v1.2.3-70-g09d2