samples: fix static code scanner issues
Pointer may be dereferenced after it was positively checked for NULL
Result of function that can return NULL may be dereferenced
Null pointer may be dereferenced
@@ -326,12 +326,15 @@ out_free:
}
}
+
+ if (metrics) {
+
for (i = 0; i < num_matches; ++i) {
if (metrics[i].groups)
free(metrics[i].groups);
}
- if (metrics)
free(metrics);
+ }
out:
return exit_code;
}
