summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-12-20 15:51:49 -0800
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-12-23 11:45:31 -0800
commit2be2b945e23ea9740aef79d1e719ce793413e129 (patch)
tree08c77aca2541c256f72b2e95f068e264de5c6615 /tools
parent4839b1135d68adca9d58a0226734cac4a9793071 (diff)
downloadbluez-2be2b945e23ea9740aef79d1e719ce793413e129.tar.gz
build: Fix build when sanitizer are enabled
This fixes various issues found when sanitizers are enabled.
Diffstat (limited to 'tools')
-rw-r--r--tools/mesh-gatt/util.c11
-rw-r--r--tools/test-runner.c2
2 files changed, 9 insertions, 4 deletions
diff --git a/tools/mesh-gatt/util.c b/tools/mesh-gatt/util.c
index e845c4112..eb8b8eb29 100644
--- a/tools/mesh-gatt/util.c
+++ b/tools/mesh-gatt/util.c
@@ -41,9 +41,14 @@ void print_byte_array(const char *prefix, const void *ptr, int len)
char *line, *bytes;
int i;
- line = g_malloc(strlen(prefix) + (16 * 3) + 2);
- sprintf(line, "%s ", prefix);
- bytes = line + strlen(prefix) + 1;
+ if (prefix) {
+ line = g_malloc(strlen(prefix) + (16 * 3) + 2);
+ sprintf(line, "%s ", prefix);
+ bytes = line + strlen(prefix) + 1;
+ } else {
+ line = g_malloc((16 * 3) + 2);
+ bytes = line + 1;
+ }
for (i = 0; i < len; ++i) {
sprintf(bytes, "%2.2x ", data[i]);
diff --git a/tools/test-runner.c b/tools/test-runner.c
index eac120f4a..71cc0d2df 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -136,7 +136,7 @@ static void prepare_sandbox(void)
{
int i;
- for (i = 0; mount_table[i].fstype; i++) {
+ for (i = 0; mount_table[i].fstype && mount_table[i].target; i++) {
struct stat st;
if (lstat(mount_table[i].target, &st) < 0) {