
KR> +static const char *graphics_rasd_to_vdev(CMPIInstance *inst, KR> + struct virt_device *dev) KR> +{ KR> + const char *val; KR> + const char *msg = NULL; KR> + const char *keymap; KR> + char *addr = NULL; KR> + char *port = NULL; KR> + KR> + dev->dev.graphics.type = strdup("vnc"); KR> + KR> + /* FIXME: Add logic to prevent address:port collisions */ KR> + if (cu_get_str_prop(inst, "Address", &val) != CMPI_RC_OK) { KR> + dev->dev.graphics.port = strdup("-1"); KR> + dev->dev.graphics.host = strdup("127.0.0.1"); KR> + } else if (parse_id(val, &addr, &port) == 1) { KR> + dev->dev.graphics.port = strdup(port); KR> + dev->dev.graphics.host = strdup(addr); What I meant was just make the call: parse_id(val, &dev->dev.graphics.port, &dev->dev.graphics.host); Since parse_id() does an alloc, we don't need to do another alloc and then free the first. If you want to keep the code cleaner, you can still use the char pointers, but no need to strdup() and free() them at the end. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com