Fix dereference NULL 59/154859/1
authorjusung son <jusung07.son@samsung.com>
Wed, 11 Oct 2017 09:59:20 +0000 (18:59 +0900)
committerjusung son <jusung07.son@samsung.com>
Wed, 11 Oct 2017 10:02:01 +0000 (19:02 +0900)
Change-Id: Ic76d8cf01b2e3133280e39826c3707ba5b8bdbf9
Signed-off-by: jusung son <jusung07.son@samsung.com>
src/message_port_common.c
src/message_port_local.c

index 651b7c0..ec32d33 100755 (executable)
@@ -198,7 +198,7 @@ int read_string_from_socket(int fd, char **buffer, int *string_len)
 
 static int __dbus_init(void)
 {
-       bool ret = false;
+       bool ret = true;
        GError *error = NULL;
 
        gdbus_conn = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &error);
@@ -207,17 +207,10 @@ static int __dbus_init(void)
                        _LOGE("Failed to get dbus [%s]", error->message);
                        g_error_free(error);
                }
-               goto out;
+               ret = false;
        }
 
-       ret = true;
-
-out:
-       if (!gdbus_conn)
-               g_object_unref(gdbus_conn);
-
        return ret;
-
 }
 
 bool initialize_common(void)
index cdc9c87..d9a01ea 100755 (executable)
@@ -720,7 +720,6 @@ static int __message_port_send_async(port_list_info_s *port_info, bundle *kb, co
 {
        int ret = 0;
        int data_len;
-       int local_port_len = 0;
        unsigned int nb = 0;
        bundle_raw *kb_data = NULL;
        int sequence = SEQUENCE_START;
@@ -745,11 +744,8 @@ static int __message_port_send_async(port_list_info_s *port_info, bundle *kb, co
                goto out;
        }
 
-       if (local_port != NULL)
-               local_port_len = strlen(local_port) + 1;
-
        ret = write_string_to_socket(port_info->send_sock_fd, local_port,
-                       local_port_len, &nb, &sequence);
+                       strlen(local_port) + 1, &nb, &sequence);
        if (ret != MESSAGE_PORT_ERROR_NONE) {
                _LOGE("write local_port fail");
                goto out;