Fix static analyzer issues
[platform/core/appfw/pkgmgr-info.git] / src / pkgmgrinfo_db.c
index c16f7d3..453b5bc 100644 (file)
@@ -19,7 +19,6 @@
 #include "pkgmgrinfo_debug.h"
 #include "pkgmgrinfo_private.h"
 #include "pkgmgr_parser.h"
-#include "pkgmgr_parser_internal.h"
 
 #define QUERY_CREATE_TABLE_PACKAGE_CERT_INDEX_INFO \
        "CREATE TABLE IF NOT EXISTS package_cert_index_info( " \
@@ -184,7 +183,7 @@ static char *_get_db_path(uid_t uid)
 static int __attach_and_create_view(sqlite3 *handle, const char *db, const char *tables[], uid_t uid)
 {
        int i;
-       char *err;
+       char *err = NULL;
        char query[MAX_QUERY_LEN];
 
        if (uid != GLOBAL_USER && uid != ROOT_UID) {
@@ -279,11 +278,10 @@ API const char *getIconPath(uid_t uid, bool readonly)
 
        if (readonly)
                path = tzplatform_mkpath(TZ_SYS_RO_ICONS, "/");
-       else
-               path = tzplatform_mkpath(TZ_SYS_RW_ICONS, "/");
 
        /* just allow certain users to create the icon directory if needed. */
-       if (uid_caller == ROOT_UID  || uid_caller == APPFW_UID || uid_caller == uid)
+       if (path && (uid_caller == ROOT_UID  ||
+               uid_caller == APPFW_UID || uid_caller == uid))
                _mkdir_for_user(path, uid, gid);
 
        return path;
@@ -315,7 +313,7 @@ API char *getUserPkgParserDBPathUID(uid_t uid)
                tzplatform_reset_user();
        }
 
-       // just allow certain users to create the dbspace directory if needed.
+       /* just allow certain users to create the dbspace directory if needed. */
        if (uid_caller == ROOT_UID  || uid_caller == APPFW_UID || uid_caller == uid)
                _mkdir_for_user(db_path, uid, gid);
 
@@ -350,7 +348,7 @@ API char *getUserPkgCertDBPathUID(uid_t uid)
                tzplatform_reset_user();
        }
 
-       // just allow certain users to create the dbspace directory if needed.
+       /* just allow certain users to create the dbspace directory if needed. */
        if (uid_caller == ROOT_UID || uid_caller == APPFW_UID || uid_caller == uid)
                _mkdir_for_user(db_path, uid, gid);