Add an exception handling about out of memory 78/142378/2
authorHwankyu Jhun <h.jhun@samsung.com>
Thu, 3 Aug 2017 09:52:50 +0000 (18:52 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Thu, 3 Aug 2017 23:15:09 +0000 (08:15 +0900)
Change-Id: I87aec1626f405502215e6c80923bce856963c834
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/loader_info.c

index 8cce136..bf9dc49 100644 (file)
 
 static loader_info_t *__create_loader_info()
 {
-       loader_info_t *info = malloc(sizeof(loader_info_t));
+       loader_info_t *info;
 
-       if (!info)
+       info = malloc(sizeof(loader_info_t));
+       if (info == NULL) {
+               _E("Out of memory");
                return NULL;
+       }
 
        info->type = 0;
        info->name = NULL;
@@ -187,6 +190,8 @@ static GList *__parse_file(GList *list, const char *path)
                                list = g_list_append(list, cur_info);
                        }
                        cur_info = __create_loader_info();
+                       if (!cur_info)
+                               break;
                        continue;
                }