Fix svace defects 23/53123/1 accepted/tizen/mobile/20151202.091504 accepted/tizen/tv/20151202.091532 accepted/tizen/wearable/20151202.091605 submit/tizen/20151202.053839
authorMinje Ahn <minje.ahn@samsung.com>
Wed, 2 Dec 2015 03:09:57 +0000 (12:09 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Wed, 2 Dec 2015 03:09:57 +0000 (12:09 +0900)
Change-Id: Ife939507429047da6d67bdc137b78e8b92c274d3
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
lib/media-util-ipc.c
src/common/media-common-system.c
src/scanner-v2/media-scanner-scan-v2.c

index 13615f1..eed359c 100755 (executable)
@@ -122,9 +122,10 @@ int ms_ipc_create_client_socket(ms_protocol_e protocol, int timeout_sec, ms_sock
                memset(&serv_addr, 0, sizeof(serv_addr));
                serv_addr.sun_family = AF_UNIX;
                MSAPI_DBG("%s", sock_info->sock_path);
-               unlink(sock_info->sock_path);
-               strncpy(serv_addr.sun_path, sock_info->sock_path, strlen(sock_info->sock_path));
-
+               if (sock_info->sock_path != NULL) {
+                       unlink(sock_info->sock_path);
+                       strncpy(serv_addr.sun_path, sock_info->sock_path, strlen(sock_info->sock_path));
+               }
                /* Bind to the local address */
                if (bind(sock, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
                        MSAPI_DBG_STRERROR("bind failed");
index 600afee..6b6fa73 100755 (executable)
@@ -216,7 +216,6 @@ static int __ms_gdbus_method_sync(const char *dest, const char *path, const char
        gboolean val_bool = FALSE;
 
        int result = 0;
-       int ret = MS_MEDIA_ERR_NONE;
 
        MS_DBG_FENTER();
 
@@ -310,9 +309,6 @@ static int __ms_gdbus_method_sync(const char *dest, const char *path, const char
 
        MS_DBG_FLEAVE();
 
-       if (ret != MS_MEDIA_ERR_NONE)
-               return ret;
-
        return result;
 }
 
index ce563da..fddc3fe 100755 (executable)
@@ -1232,6 +1232,7 @@ static int __msc_check_ignore_dir(const char *full_path, uid_t uid)
        int ret = MS_MEDIA_ERR_NONE;
        char *dir_path = NULL;
        char *leaf_path = NULL;
+       char *user_path = NULL;
 
        ret = __msc_check_file_path(full_path, uid);
        if (ret != MS_MEDIA_ERR_NONE) {
@@ -1253,7 +1254,13 @@ static int __msc_check_ignore_dir(const char *full_path, uid_t uid)
                }
 
                /*If root path, Stop Scanning*/
-               if (strcmp(dir_path, __msc_get_path(uid)) == 0)
+               user_path = __msc_get_path(uid);
+               if (user_path == NULL) {
+                       ret = MS_MEDIA_ERR_INTERNAL;
+                       break;
+               }
+
+               if (strcmp(dir_path, user_path) == 0)
                        break;
                else if (MS_STRING_VALID(MEDIA_ROOT_PATH_SDCARD) && (strcmp(dir_path, MEDIA_ROOT_PATH_SDCARD) == 0))
                        break;
@@ -1272,6 +1279,7 @@ static int __msc_check_ignore_dir(const char *full_path, uid_t uid)
        }
 
        MS_SAFE_FREE(dir_path);
+       MS_SAFE_FREE(user_path);
 
        return ret;
 }