Fix: free memory by KDBUS_CMD_FREE ioctl 39/85539/1
authorKazimierz Krosman <k.krosman@samsung.com>
Thu, 25 Aug 2016 13:25:52 +0000 (15:25 +0200)
committerKazimierz Krosman <k.krosman@samsung.com>
Thu, 25 Aug 2016 13:36:26 +0000 (15:36 +0200)
Change-Id: I6252c1783fa9dd52343bd128fa975b38191247f3

src/libdbuspolicy1.c

index 79b858b..e1e9216 100644 (file)
@@ -79,6 +79,7 @@ static int kdbus_open_bus(const char *path)
 static int kdbus_hello(bool bus_type, uint64_t hello_flags, uint64_t attach_flags_send, uint64_t attach_flags_recv)
 {
        struct kdbus_cmd_hello cmd;
+       struct kdbus_cmd_free cmd_free;
        int fd = g_conn[bus_type].fd;
 
        cmd.size = sizeof(cmd);
@@ -94,6 +95,9 @@ static int kdbus_hello(bool bus_type, uint64_t hello_flags, uint64_t attach_flag
        if (MAP_FAILED == (g_conn[bus_type].pool = mmap(NULL, KDBUS_POOL_SIZE, PROT_READ, MAP_SHARED, fd, 0)))
                return -errno;
 
+       cmd_free.offset = cmd.offset;
+       cmd_free.size = sizeof(struct kdbus_cmd_free);
+       ioctl(g_conn[bus_type].fd, KDBUS_CMD_FREE, &cmd_free);
        return 0;
 }