aboutsummaryrefslogtreecommitdiff
path: root/util/mtp-probe.c
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2015-10-04 13:29:11 +0200
committerMarcus Meissner <marcus@jet.franken.de>2015-10-04 13:29:11 +0200
commit7301873feb87c7798654e4cf5826c7c9b93c338e (patch)
tree49fd0a494995d7ecba51ab6da7960b9d5c5e74e3 /util/mtp-probe.c
parentfe2b9d6d807c117d3ae2319db30326f1dcd5135c (diff)
downloadlibmtp-7301873feb87c7798654e4cf5826c7c9b93c338e.tar.gz
close the directory on error (Coverity)
Diffstat (limited to 'util/mtp-probe.c')
-rw-r--r--util/mtp-probe.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/util/mtp-probe.c b/util/mtp-probe.c
index 600e6cd..e3ae3b7 100644
--- a/util/mtp-probe.c
+++ b/util/mtp-probe.c
@@ -249,8 +249,10 @@ static int check_sysfs(char *sysfspath)
/* Check for dirs that identify interfaces */
ret = regcomp(&r, "^[0-9]+-[0-9]+(.[0-9])?\\:[0-9]+\\.[0-9]+$", REG_EXTENDED | REG_NOSUB);
- if (ret)
+ if (ret) {
+ closedir(dir);
return -1;
+ }
while ((dent = readdir(dir))) {
struct stat st;