Fix static analysis tool issue 33/103033/3 accepted/tizen/3.0/common/20161208.153338 accepted/tizen/3.0/ivi/20161208.062722 accepted/tizen/3.0/mobile/20161208.062355 accepted/tizen/3.0/tv/20161208.062547 accepted/tizen/3.0/wearable/20161208.062617 submit/tizen_3.0/20161207.072901
authorJunghyun Yeon <jungh.yeon@samsung.com>
Wed, 7 Dec 2016 05:30:28 +0000 (14:30 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Wed, 7 Dec 2016 06:57:04 +0000 (15:57 +0900)
- Remove unreachable code
- fix memory leak

Change-Id: Ia7ad1372fde5acc89dc6e2657368491c8c2b8da2
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
plugin/app2sd/server/app2sd_internals_registry.c
plugin/app2sd/server/app2sd_server.c

index 846d121..42ee967 100644 (file)
@@ -312,8 +312,8 @@ char *_app2sd_get_password_from_db(const char *pkgid, uid_t uid)
 
        strncpy(passwd, (const char *)sqlite3_column_text(stmt, 1),
                PASSWORD_LENGTH);
-       if (passwd == NULL) {
-               _E("data is NULL");
+       if (strlen(passwd) == 0) {
+               _E("data is empty");
                goto FINISH_OFF;
        }
        if (SQLITE_OK != sqlite3_finalize(stmt)) {
index cd863af..61977c7 100644 (file)
@@ -28,6 +28,15 @@ guint source_id;
 
 GMainLoop *app2sd_mainloop = NULL;
 
+static void __free_dir_detail(gpointer data)
+{
+       app2ext_dir_details *dir_detail = (app2ext_dir_details *)data;
+
+       if (dir_detail->name)
+               free(dir_detail->name);
+       free(dir_detail);
+}
+
 gboolean __exit_app2sd_server(void *data)
 {
        if (processing_busy_cnt <= 0) {
@@ -272,6 +281,7 @@ static void _app2sd_server_pre_app_install(GDBusConnection *connection, const gc
                _E("error(%d)", ret);
                result = ret;
        }
+       g_list_free_full(dir_list, __free_dir_detail);
 
        param = g_variant_new("(i)", result);
        g_dbus_method_invocation_return_value(invocation, param);
@@ -370,6 +380,7 @@ static void _app2sd_server_pre_app_upgrade(GDBusConnection *connection, const gc
                _E("error(%d)", ret);
                result = ret;
        }
+       g_list_free_full(dir_list, __free_dir_detail);
 
        param = g_variant_new("(i)", result);
        g_dbus_method_invocation_return_value(invocation, param);
@@ -594,6 +605,7 @@ static void _app2sd_server_pre_move_installed_app(GDBusConnection *connection,
                result = ret;
        }
 
+       g_list_free_full(list, __free_dir_detail);
        param = g_variant_new("(i)", result);
        g_dbus_method_invocation_return_value(invocation, param);
 }