Skip to content
Snippets Groups Projects
Commit 5cc450c7 authored by Beat Küng's avatar Beat Küng Committed by Lorenz Meier
Browse files

srf02: fix resource leak (unclosed fd)

parent ab94bf1d
No related branches found
No related tags found
No related merge requests found
......@@ -700,7 +700,7 @@ void info();
void
start(uint8_t rotation)
{
int fd;
int fd = -1;
if (g_dev != nullptr) {
errx(1, "already started");
......@@ -728,10 +728,15 @@ start(uint8_t rotation)
goto fail;
}
close(fd);
exit(0);
fail:
if (fd >= 0) {
close(fd);
}
if (g_dev != nullptr) {
delete g_dev;
g_dev = nullptr;
......
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