3ff4dbe02e1f — Chris Cannam 5 years ago
Fix static analysis problems reported by Coverity scan
1 files changed, 8 insertions(+), 1 deletions(-)

M src/MiniBpm.cpp
M src/MiniBpm.cpp +8 -1
@@ 258,7 258,9 @@ public:
                 else multiple = multiple * 2;
             }
 
-            filtered[i] /= n;
+            if (n != 0) {
+                filtered[i] /= n;
+            }
         }
     }
 

          
@@ 521,6 523,8 @@ public:
 
 	if (acfLength < maxlag) {
 	    // Not enough data
+            delete[] acf;
+            delete[] temp;
 	    return 0.0;
 	}
 

          
@@ 552,6 556,9 @@ public:
 	}
 
         if (candidateMap.empty()) {
+            delete[] cf;
+            delete[] acf;
+            delete[] temp;
             return 0.0;
         }