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:
parent
dc05ffffaa
commit
f582757dd4
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue