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/protocol/pipeline/push.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/protocol/pipeline/push.c') diff --git a/src/protocol/pipeline/push.c b/src/protocol/pipeline/push.c index 4704a323..0f973f8a 100644 --- a/src/protocol/pipeline/push.c +++ b/src/protocol/pipeline/push.c @@ -84,8 +84,10 @@ nni_push_sock_fini(void *arg) { nni_push_sock *push = arg; - nni_cv_fini(&push->cv); - NNI_FREE_STRUCT(push); + if (push != NULL) { + nni_cv_fini(&push->cv); + NNI_FREE_STRUCT(push); + } } @@ -116,8 +118,10 @@ nni_push_pipe_fini(void *arg) { nni_push_pipe *pp = arg; - nni_msgq_fini(pp->mq); - NNI_FREE_STRUCT(pp); + if (pp != NULL) { + nni_msgq_fini(pp->mq); + NNI_FREE_STRUCT(pp); + } } -- cgit v1.2.3-70-g09d2