devilhorns pushed a commit to branch master.

commit 5f3a2dd5f6bd2cfb9e25e12535b692fff1cdb009
Author: Chris Michael <[email protected]>
Date:   Tue Jul 9 13:28:37 2013 +0100

    Don't leak fd handles (ie: leave files open) when checking devices
    
    NB: Fixes Coverity CID1039175
    
    Signed-off-by: Chris Michael <[email protected]>
---
 src/lib/emotion/emotion_webcam.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/lib/emotion/emotion_webcam.c b/src/lib/emotion/emotion_webcam.c
index 1f74a7d..9b6d502 100644
--- a/src/lib/emotion/emotion_webcam.c
+++ b/src/lib/emotion/emotion_webcam.c
@@ -122,6 +122,8 @@ _emotion_check_device(Emotion_Webcam *ew)
 
    EINA_REFCOUNT_INIT(ew);
 
+   if (fd > 0) close(fd);
+
    return;
 
  on_error:
@@ -131,6 +133,7 @@ _emotion_check_device(Emotion_Webcam *ew)
    eina_stringshare_del(ew->device);
    eina_stringshare_del(ew->name);
    free(ew);
+   if (fd > 0) close(fd);
 }
 
 static Emotion_Webcam *

-- 

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk

Reply via email to