Found by Coverity:

CID 709297: Resource leak (RESOURCE_LEAK)
Calling opening function "open".
Assigning: "fd" = handle returned from "open((char 
*)QByteArray(this->m_device.toUtf8()).data(), 0)".
 89    const int fd = KDE_open((char *) m_device.toUtf8().data(), O_RDONLY);
At conditional (1): "fd < 0" taking the false branch.
 90    if (fd < 0) {
 91        fprintf(stderr, "Can't open Jog Shuttle FILE DESCRIPTOR\n");
 92        return;;
 93    }
 94    EV ev;
 95
At conditional (2): "ioctl(fd, 1074021776UL, 1) < 0" taking the true branch.
Variable "fd" is not closed or saved in function "ioctl".
 96    if (ioctl(fd, EVIOCGRAB, 1) < 0) {
 97        fprintf(stderr, "Can't get exclusive access on  Jog Shuttle FILE 
DESCRIPTOR\n");
Handle variable "fd" going out of scope leaks the handle.
 98        return;;
 99    }
---
 src/jogshuttle.cpp |    1 +
 1 file changed, 1 insertion(+)

diff --git a/src/jogshuttle.cpp b/src/jogshuttle.cpp
index b5dd0e8..8446076 100644
--- a/src/jogshuttle.cpp
+++ b/src/jogshuttle.cpp
@@ -95,6 +95,7 @@ void ShuttleThread::run()
 
     if (ioctl(fd, EVIOCGRAB, 1) < 0) {
         fprintf(stderr, "Can't get exclusive access on  Jog Shuttle FILE 
DESCRIPTOR\n");
+        close(fd);
         return;;
     }
 
-- 
1.7.10.4


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Kdenlive-devel mailing list
Kdenlive-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kdenlive-devel

Reply via email to