tools: acrn-manager: fix fd leaking

close dir to avoid fd leaking.

Tracked-On: #1477
Signed-off-by: Tao, Yuhong <yuhong.tao@intel.com>
Signed-off-by: Yan, Like <like.yan@intel.com>
This commit is contained in:
Yan, Like 2018-10-12 15:37:16 +08:00 committed by wenlingz
parent dc05ffffaa
commit f582757dd4
2 changed files with 5 additions and 1 deletions

View File

@ -484,7 +484,6 @@ static int connect_to_server(const char *name)
if ((ret >= 0) && (ret < strlen(s_name)))
printf("WARN: %s is truncated\n", s_name);
closedir(dir);
ret =
connect(mfd->fd, (struct sockaddr *)&mfd->addr, sizeof(mfd->addr));
if (ret < 0) {
@ -499,6 +498,7 @@ static int connect_to_server(const char *name)
goto alloc_val;
}
closedir(dir);
return ret;
alloc_val:
@ -507,6 +507,7 @@ static int connect_to_server(const char *name)
sock_err:
free(mfd);
alloc_mfd:
closedir(dir);
return ret;
}

View File

@ -150,6 +150,7 @@ static void _scan_alive_vm(void)
vm->update = update_count;
}
closedir(dir);
}
static void _scan_added_vm(void)
@ -218,6 +219,8 @@ static void _scan_added_vm(void)
vm->state = VM_CREATED;
vm->update = update_count;
}
closedir(dir);
}
static void _remove_dead_vm(void)