--- Gnu-Mach/xen/block.c 2020/09/02 04:45:34 1.1.1.1 +++ Gnu-Mach/xen/block.c 2020/09/02 04:47:56 1.1.1.2 @@ -217,7 +217,7 @@ void hyp_block_init(void) { sprintf(device_name, "%s%ds%d", prefix, disk, partition); else sprintf(device_name, "%s%d", prefix, disk); - bd->name = (char*) kalloc(strlen(device_name)); + bd->name = (char*) kalloc(strlen(device_name) + 1); strcpy(bd->name, device_name); /* Get domain id of backend driver. */ @@ -382,8 +382,8 @@ device_open (ipc_port_t reply_port, mach port = ipc_port_alloc_kernel(); if (port == IP_NULL) { - err = KERN_RESOURCE_SHORTAGE; - goto out; + device_close(bd); + return KERN_RESOURCE_SHORTAGE; } bd->port = port; @@ -396,7 +396,6 @@ device_open (ipc_port_t reply_port, mach ipc_port_nsrequest (bd->port, 1, notify, ¬ify); assert (notify == IP_NULL); -out: if (IP_VALID (reply_port)) ds_device_open_reply (reply_port, reply_port_type, D_SUCCESS, port); else