summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cam/main.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/cam/main.cpp b/src/cam/main.cpp
index 7c47ce65..0c66a98e 100644
--- a/src/cam/main.cpp
+++ b/src/cam/main.cpp
@@ -160,7 +160,8 @@ static int capture()
Request *request = camera->createRequest();
if (!request) {
std::cerr << "Can't create request" << std::endl;
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto out;
}
std::map<Stream *, Buffer *> map;
@@ -168,13 +169,13 @@ static int capture()
ret = request->setBuffers(map);
if (ret < 0) {
std::cerr << "Can't set buffers for request" << std::endl;
- return ret;
+ goto out;
}
ret = camera->queueRequest(request);
if (ret < 0) {
std::cerr << "Can't queue request" << std::endl;
- return ret;
+ goto out;
}
}
@@ -184,6 +185,9 @@ static int capture()
ret = loop->exec();
camera->stop();
+out:
+ camera->freeBuffers();
+
return ret;
}