[IBAL] Handle acquire_ca failing in create_iou
[mirror/winof/.git] / core / al / al_dm.c
index eac52c5..9d95fa6 100644 (file)
@@ -27,7 +27,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
  * SOFTWARE.\r
  *\r
- * $Id:$\r
+ * $Id$\r
  */\r
 \r
 #include "al_ca.h"\r
@@ -213,7 +213,7 @@ ib_create_ioc(
                CL_TRACE_EXIT( AL_DBG_ERROR, g_al_dbg_lvl, ("IB_INVALID_CA_HANDLE\n") );\r
                return IB_INVALID_CA_HANDLE;\r
        }\r
-       if( !p_ioc_profile || ph_ioc )\r
+       if( !p_ioc_profile || !ph_ioc )\r
        {\r
                CL_TRACE_EXIT( AL_DBG_ERROR, g_al_dbg_lvl, ("IB_INVALID_PARAMETER\n") );\r
                return IB_INVALID_PARAMETER;\r
@@ -1066,6 +1066,14 @@ create_iou(
 \r
        /* It is now safe to acquire the CA and initialize the p_ci_ca pointer. */\r
        h_ca = acquire_ca( p_pnp_rec->guid );\r
+       if( !h_ca )\r
+       {\r
+               p_iou->obj.pfn_destroy( &p_iou->obj, NULL );\r
+               AL_TRACE_EXIT( AL_DBG_ERROR,\r
+                       ("acquire_ca for GUID %016I64x failed.\n", p_pnp_rec->guid) );\r
+               return IB_INVALID_CA_HANDLE;\r
+       }\r
+\r
        p_iou->obj.p_ci_ca = h_ca->obj.p_ci_ca;\r
 \r
        /* Initialize the IO unit IOC list. */\r