Change glist add function
[platform/core/appfw/pkgmgr-info.git] / src / pkgmgrinfo_private.c
index 04cfb65..68f6f36 100644 (file)
@@ -463,7 +463,7 @@ int _add_icon_info_into_list(const char *locale, char *value, GList **icon)
        }
        info->text = value;
        info->lang = strdup(locale);
-       *icon = g_list_append(*icon, info);
+       *icon = g_list_prepend(*icon, info);
 
        return PMINFO_R_OK;
 }
@@ -479,7 +479,7 @@ int _add_label_info_into_list(const char *locale, char *value, GList **label)
        }
        info->text = value;
        info->lang = strdup(locale);
-       *label = g_list_append(*label, info);
+       *label = g_list_prepend(*label, info);
 
        return PMINFO_R_OK;
 }
@@ -573,8 +573,10 @@ int __open_db(const char *path, sqlite3 **db, int flags)
        int ret;
 
        ret = sqlite3_open_v2(path, db, flags, NULL);
-       if (ret != SQLITE_OK)
+       if (ret != SQLITE_OK) {
+               sqlite3_close_v2(*db);
                return ret;
+       }
 
        ret = sqlite3_busy_handler(*db, __db_busy_handler, NULL);
        if (ret != SQLITE_OK) {