Unverified Commit d2ff3f89 by Christian Brauner Committed by GitHub

Merge pull request #2418 from 2xsec/bugfix

fix fd handle leak
parents d3d9f55b 5090cb06
...@@ -91,6 +91,7 @@ static void opentty(const char * tty, int which) { ...@@ -91,6 +91,7 @@ static void opentty(const char * tty, int which) {
flags &= ~O_NONBLOCK; flags &= ~O_NONBLOCK;
if (fcntl(fd, F_SETFL, flags) < 0) { if (fcntl(fd, F_SETFL, flags) < 0) {
printf("WARN: could not set fd flags: %s\n", strerror(errno)); printf("WARN: could not set fd flags: %s\n", strerror(errno));
close(fd);
return; return;
} }
......
...@@ -555,7 +555,10 @@ int main(int argc, char *argv[]) ...@@ -555,7 +555,10 @@ int main(int argc, char *argv[])
printf("All get_item tests passed\n"); printf("All get_item tests passed\n");
fret = EXIT_SUCCESS; fret = EXIT_SUCCESS;
out: out:
c->destroy(c); if (c) {
lxc_container_put(c); c->destroy(c);
lxc_container_put(c);
}
exit(fret); exit(fret);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment