Release CIMCEnv on client connection error
If the client connection fails, the allocated CIMCEnv must be released.
Since the release function pointer is embedded into the client struct,
a caller has no way to call this function seeing a NULL client pointer.
References:
http://sourceforge.net/p/sblim/bugs/1933
https://bugzilla.suse.com/show_bug.cgi?id=591060
diff --git a/frontend/sfcc/sfcclient.c b/frontend/sfcc/sfcclient.c
index c287577..bfd596f 100644
--- a/frontend/sfcc/sfcclient.c
+++ b/frontend/sfcc/sfcclient.c
@@ -109,6 +109,15 @@
}
}
pthread_mutex_unlock(&ConnectionControl.ccMux);
+ if (!cc) {
+ /* cleanup ccEnv after pthread_mutex_unlock */
+ cmciRelease(NULL);
+ if (rc) {
+ rc->rc = CMPI_RC_ERR_FAILED;
+ rc->msg = NULL;
+ }
+ }
+
return cc;
}