Skip to content
Snippets Groups Projects
Commit eb3f45c5 authored by Gonglei (Arei)'s avatar Gonglei (Arei) Committed by Stefan Hajnoczi
Browse files

qemu-bridge-helper: Fix fd leak in main()


initialize fd and ctlfd, and close them at the end

Signed-off-by: default avatarGonglei <arei.gonglei@huawei.com>
Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
parent ff4873cb
No related branches found
No related tags found
No related merge requests found
......@@ -229,7 +229,7 @@ int main(int argc, char **argv)
unsigned long ifargs[4];
#endif
int ifindex;
int fd, ctlfd, unixfd = -1;
int fd = -1, ctlfd = -1, unixfd = -1;
int use_vnet = 0;
int mtu;
const char *bridge = NULL;
......@@ -436,7 +436,12 @@ int main(int argc, char **argv)
/* profit! */
cleanup:
if (fd >= 0) {
close(fd);
}
if (ctlfd >= 0) {
close(ctlfd);
}
while ((acl_rule = QSIMPLEQ_FIRST(&acl_list)) != NULL) {
QSIMPLEQ_REMOVE_HEAD(&acl_list, entry);
g_free(acl_rule);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment