elm_need_efret() - improve error handling according to coverity
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Mon, 8 Aug 2016 06:18:56 +0000 (15:18 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Mon, 8 Aug 2016 08:47:14 +0000 (17:47 +0900)
fix CID 1360466

we don't actually chekc if efreet inits right with elm_need_efreet()
as we just assume it inits (And there pretty much is no case where it
will not), but make coverity happy and check.

@fix

src/lib/elementary/elm_main.c

index 5152394..3a22a26 100644 (file)
@@ -594,11 +594,20 @@ EAPI Eina_Bool
 elm_need_efreet(void)
 {
    if (_elm_need_efreet) return EINA_TRUE;
+   if (!efreet_init()) return EINA_FALSE;
+   if (!efreet_mime_init())
+     {
+        efreet_shutdown();
+        return EINA_FALSE;
+     }
+   if (!efreet_trash_init())
+     {
+        efreet_mime_shutdown();
+        efreet_shutdown();
+        return EINA_FALSE;
+     }
    _elm_need_efreet = EINA_TRUE;
-   efreet_init();
-   efreet_mime_init();
-   efreet_trash_init();
-    /*
+   /*
      {
         Eina_List **list;
 
@@ -611,7 +620,7 @@ elm_need_efreet(void)
              *list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf));
           }
      }
-   */
+    */
    return EINA_TRUE;
 }