Add some exception handling 75/43875/2 accepted/tizen/mobile/20150717.060236 accepted/tizen/tv/20150717.060248 accepted/tizen/wearable/20150717.060259 submit/tizen/20150717.020519
authorSangyoon Jang <s89.jang@samsung.com>
Wed, 15 Jul 2015 01:52:31 +0000 (10:52 +0900)
committerSangyoon Jang <s89.jang@samsung.com>
Wed, 15 Jul 2015 06:45:37 +0000 (15:45 +0900)
Change-Id: I7b79a203344a164a89f0e5f72807c2e71bbf8216
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
am_daemon/amd_appinfo.c

index 20b9968..2ec0271 100644 (file)
@@ -288,6 +288,10 @@ static struct user_appinfo *_add_user_appinfo(uid_t uid)
        info->uid = uid;
        info->tbl = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
                        _free_appinfo);
+       if (info->tbl == NULL) {
+               _E("out of memory");
+               return NULL;
+       }
 
        g_hash_table_insert(user_tbl, GINT_TO_POINTER(uid), info);
 
@@ -453,6 +457,8 @@ int appinfo_init(void)
 
        user_tbl = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL,
                        _free_user_appinfo);
+       if (user_tbl == NULL)
+               return -1;
 
        pkg_pending = g_hash_table_new_full(g_str_hash, g_str_equal,
                        free, free);
@@ -503,6 +509,10 @@ const struct appinfo *appinfo_find(uid_t caller_uid, const char *appid)
 
        /* search again from global table */
        info = _find_user_appinfo(GLOBAL_USER);
+       if (info == NULL) {
+               _E("cannot find global appinfo table!");
+               return NULL;
+       }
 
        return g_hash_table_lookup(info->tbl, appid);
 }