diff -r 1fa3fb47b1e3 -r c2e43643db4c khronosfws/openmax_al/src/mmf_adaptation/xametadataadaptctxmmf.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xametadataadaptctxmmf.c Wed Aug 18 10:17:22 2010 +0300 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xametadataadaptctxmmf.c Thu Sep 02 20:58:01 2010 +0300 @@ -28,43 +28,39 @@ DEBUG_API("->XAMetadataAdaptCtxMMF_Create"); pSelf = calloc(1, sizeof(XAMetadataAdaptationMMFCtx)); - if (pSelf) + if(!pSelf) { - - if (XAAdaptationBaseMMF_Init(&(pSelf->baseObj), XAMDAdaptation) - != XA_RESULT_SUCCESS) - { - DEBUG_ERR("Failed to init base context!!!"); - free(pSelf); - pSelf = NULL; - } - else - - { - pSelf->baseObj.baseObj.fwtype = FWMgrFWMMF; - pSelf->xaSource = pDataSrc; - } + /* memory allocation failed */ + DEBUG_ERR("Failed to allocate memory"); + DEBUG_API("<-XAMetadataAdaptCtxMMF_Create"); + return NULL; + } - if (pDataSrc) - { - pSelf->mmfContext - = mmf_metadata_utility_init( - (char *) (((XADataLocator_URI*) (pDataSrc->pLocator))->URI)); - if (!pSelf->mmfContext) - { - DEBUG_ERR("Failed to init mmf context!!!"); - free(pSelf); - pSelf = NULL; - } - } - - } - else + if (XAAdaptationBaseMMF_Init(&(pSelf->baseObj), XAMDAdaptation) + != XA_RESULT_SUCCESS) { - DEBUG_ERR("Failed to create XAMetadataAdaptationMMFCtx !!!"); + free(pSelf); + DEBUG_ERR("Failed to init base context!!!"); + DEBUG_API("<-XAMetadataAdaptCtxMMF_Create"); return NULL; } - + + pSelf->baseObj.baseObj.fwtype = FWMgrFWMMF; + pSelf->xaSource = pDataSrc; + + if (pDataSrc) + { + pSelf->mmfContext + = mmf_metadata_utility_init( + (char *) (((XADataLocator_URI*) (pDataSrc->pLocator))->URI)); + if (!pSelf->mmfContext) + { + free(pSelf); + DEBUG_ERR("Failed to init mmf context!!!"); + DEBUG_API("<-XAMetadataAdaptCtxMMF_Create"); + return NULL; + } + } DEBUG_API("<- XAMetadataAdaptCtxMMF_Create"); return (XAAdaptationBaseCtx*) (&pSelf->baseObj.baseObj);