summaryrefslogtreecommitdiff
path: root/src/qcam/viewfinder.h
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2019-09-23 14:20:29 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2019-09-24 17:35:23 +0100
commitf0b2582c4961ce9e5b637a2a326aa59ebc905e52 (patch)
treebe68680d7e3e1ed7635c29b286714aea9ca18145 /src/qcam/viewfinder.h
parentad0a61e32ca54ddcb400bbb2d8396f15b10bda90 (diff)
qcam: Fix ViewFinder memory leak
When setting the format on the ViewFinder, a new image_ is allocated. Any change in format deletes the existing allocation, but it is not cleaned up on shutdown: Direct leak of 32 byte(s) in 1 object(s) allocated from: #0 0x7f0bf8a7e17f in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10e17f) #1 0x564c7205f7b0 in ViewFinder::setFormat(unsigned int, unsigned int, unsigned int) ../src/qcam/viewfinder.cpp:43 #2 0x564c71fec467 in MainWindow::startCapture() ../src/qcam/main_window.cpp:152 #3 0x564c71fe6c1a in MainWindow::MainWindow(libcamera::CameraManager*, OptionsParser::Options const&) ../src/qcam/main_window.cpp:40 #4 0x564c71fdf133 in main ../src/qcam/main.cpp:76 #5 0x7f0bf5944b6a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x26b6a) Provide a ViewFinder destructor, and delete the allocation as appropriate. Fixes: 97e8b3a2eb32 ("qcam: Add Qt-based GUI application") Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/qcam/viewfinder.h')
-rw-r--r--src/qcam/viewfinder.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/qcam/viewfinder.h b/src/qcam/viewfinder.h
index c9ca9891..33bdb146 100644
--- a/src/qcam/viewfinder.h
+++ b/src/qcam/viewfinder.h
@@ -17,6 +17,7 @@ class ViewFinder : public QLabel
{
public:
ViewFinder(QWidget *parent);
+ ~ViewFinder();
int setFormat(unsigned int format, unsigned int width,
unsigned int height);