khronosfws/openmax_al/src/mmf_adaptation/xamediaplayeradaptctxmmf.c
changeset 53 eabc8c503852
parent 33 5e8b14bae8c3
--- a/khronosfws/openmax_al/src/mmf_adaptation/xamediaplayeradaptctxmmf.c	Fri Sep 03 19:34:12 2010 -0500
+++ b/khronosfws/openmax_al/src/mmf_adaptation/xamediaplayeradaptctxmmf.c	Tue Sep 21 11:38:43 2010 -0500
@@ -15,7 +15,6 @@
  *
  */
 
-#include <assert.h>
 #include <stdlib.h>
 #include "xamediaplayeradaptctxmmf.h"
 #include "xaadaptationmmf.h"
@@ -82,6 +81,7 @@
             pSelf->cameraSinkSynced = XA_BOOLEAN_FALSE;
             pSelf->rateprops = XA_RATEPROP_SMOOTHVIDEO | XA_RATEPROP_NOPITCHCORAUDIO;
             pSelf->playrate = 1000;
+            pSelf->mmfContext = NULL;
             }
         }
     else
@@ -93,7 +93,7 @@
     if (pSelf)
         {
         res = mmf_backend_engine_init(&(pSelf->mmfContext));
-        if (!(pSelf->mmfContext) || (res != XA_RESULT_SUCCESS))
+        if ((res != XA_RESULT_SUCCESS) || !(pSelf->mmfContext))
             {
             /* TODO Check to make sure there is no undeleted MMF objects here*/
             DEBUG_ERR("Failed to init mmf context!!!");
@@ -111,12 +111,16 @@
             if (!pSelf->mmfMetadataContext)
                 {
                 DEBUG_ERR("Failed to init mmf metadata context!!!");
-                pSelf->mmfMetadataContext = NULL;
+                free(pSelf);
+                pSelf = NULL;
+                return NULL;
                 }
             }
         else
             {
             DEBUG_ERR("Failed to create XAMediaPlayerAdaptationMMFCtx !!!");
+            free(pSelf);
+            pSelf = NULL;
             return NULL;
             }
         }