From 49a99fef3e1e1ea0ecd7f131fd56da4c54bcd146 Mon Sep 17 00:00:00 2001
From: Romain Forlot <romain.forlot@iot.bzh>
Date: Thu, 14 Sep 2017 19:35:39 +0200
Subject: [PATCH] Misc Fix/Cleaning

- Correct size type ssize_t to test
- Remove free() statement because memory don't issued from a malloc
causing exception
- Remove redundant break statement after a return.

Change-Id: I47824dd5cf7afe68cd32e1c3e94e69f31d802995
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
---
 filescan-utils.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/filescan-utils.c b/filescan-utils.c
index a36969b..819efb2 100644
--- a/filescan-utils.c
+++ b/filescan-utils.c
@@ -61,7 +61,7 @@ PUBLIC json_object* ScanForConfig (const char* searchPath, CtlScanDirModeT mode,
             if (dirEnt->d_type == DT_REG || dirEnt->d_type == DT_UNKNOWN) {
 
                 // check prefix and extention
-                size_t extIdx=strlen(dirEnt->d_name)-extLen;
+                ssize_t extIdx=strlen(dirEnt->d_name)-extLen;
                 if (extIdx <= 0) continue;
                 if (pre && !strcasestr (dirEnt->d_name, pre)) continue;
                 if (ext && strcasecmp (ext, &dirEnt->d_name[extIdx])) continue;
@@ -83,7 +83,6 @@ PUBLIC json_object* ScanForConfig (const char* searchPath, CtlScanDirModeT mode,
          ScanDir (dirPath);
     }
 
-    free (dirList);
     return (responseJ);
 }
 
@@ -98,7 +97,6 @@ PUBLIC const char *GetMidleName(const char*name) {
                 if (fullname[jdx] == '-' || fullname[jdx] == '.' || fullname[jdx] == '\0') {
                     fullname[jdx] = '\0';
                     return &fullname[start];
-                    break;
                 }
             }
             break;
-- 
2.16.6