summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-06-16 21:25:49 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-06-16 21:25:49 +0000
commit3257d9b3a8f59561960c75f310fea33d23858024 (patch)
treeb16f2a6ff6150838395f6daa6bdb64677e8f5b36 /tools
parent8937ece83f3e3317a84214028ec81b1fc042a040 (diff)
Fix program error codes on memory allocations
Diffstat (limited to 'tools')
-rw-r--r--tools/hcitool.c72
1 files changed, 48 insertions, 24 deletions
diff --git a/tools/hcitool.c b/tools/hcitool.c
index 6e225cee..210ab2ba 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -1030,8 +1030,10 @@ static void cmd_dc(int dev_id, int argc, char **argv)
}
cr = malloc(sizeof(*cr) + sizeof(struct hci_conn_info));
- if (!cr)
- return;
+ if (!cr) {
+ perror("Can't allocate memory");
+ exit(1);
+ }
bacpy(&cr->bdaddr, &bdaddr);
cr->type = ACL_LINK;
@@ -1165,8 +1167,10 @@ static void cmd_rssi(int dev_id, int argc, char **argv)
}
cr = malloc(sizeof(*cr) + sizeof(struct hci_conn_info));
- if (!cr)
- return;
+ if (!cr) {
+ perror("Can't allocate memory");
+ exit(1);
+ }
bacpy(&cr->bdaddr, &bdaddr);
cr->type = ACL_LINK;
@@ -1236,8 +1240,10 @@ static void cmd_lq(int dev_id, int argc, char **argv)
}
cr = malloc(sizeof(*cr) + sizeof(struct hci_conn_info));
- if (!cr)
- return;
+ if (!cr) {
+ perror("Can't allocate memory");
+ exit(1);
+ }
bacpy(&cr->bdaddr, &bdaddr);
cr->type = ACL_LINK;
@@ -1309,8 +1315,10 @@ static void cmd_tpl(int dev_id, int argc, char **argv)
}
cr = malloc(sizeof(*cr) + sizeof(struct hci_conn_info));
- if (!cr)
- return;
+ if (!cr) {
+ perror("Can't allocate memory");
+ exit(1);
+ }
bacpy(&cr->bdaddr, &bdaddr);
cr->type = ACL_LINK;
@@ -1382,8 +1390,10 @@ static void cmd_afh(int dev_id, int argc, char **argv)
}
cr = malloc(sizeof(*cr) + sizeof(struct hci_conn_info));
- if (!cr)
- return;
+ if (!cr) {
+ perror("Can't allocate memory");
+ exit(1);
+ }
bacpy(&cr->bdaddr, &bdaddr);
cr->type = ACL_LINK;
@@ -1465,8 +1475,10 @@ static void cmd_cpt(int dev_id, int argc, char **argv)
}
cr = malloc(sizeof(*cr) + sizeof(struct hci_conn_info));
- if (!cr)
- return;
+ if (!cr) {
+ perror("Can't allocate memory");
+ exit(1);
+ }
bacpy(&cr->bdaddr, &bdaddr);
cr->type = ACL_LINK;
@@ -1546,8 +1558,10 @@ static void cmd_lst(int dev_id, int argc, char **argv)
}
cr = malloc(sizeof(*cr) + sizeof(struct hci_conn_info));
- if (!cr)
- return;
+ if (!cr) {
+ perror("Can't allocate memory");
+ exit(1);
+ }
bacpy(&cr->bdaddr, &bdaddr);
cr->type = ACL_LINK;
@@ -1631,8 +1645,10 @@ static void cmd_auth(int dev_id, int argc, char **argv)
}
cr = malloc(sizeof(*cr) + sizeof(struct hci_conn_info));
- if (!cr)
- return;
+ if (!cr) {
+ perror("Can't allocate memory");
+ exit(1);
+ }
bacpy(&cr->bdaddr, &bdaddr);
cr->type = ACL_LINK;
@@ -1700,8 +1716,10 @@ static void cmd_enc(int dev_id, int argc, char **argv)
}
cr = malloc(sizeof(*cr) + sizeof(struct hci_conn_info));
- if (!cr)
- return;
+ if (!cr) {
+ perror("Can't allocate memory");
+ exit(1);
+ }
bacpy(&cr->bdaddr, &bdaddr);
cr->type = ACL_LINK;
@@ -1770,8 +1788,10 @@ static void cmd_key(int dev_id, int argc, char **argv)
}
cr = malloc(sizeof(*cr) + sizeof(struct hci_conn_info));
- if (!cr)
- return;
+ if (!cr) {
+ perror("Can't allocate memory");
+ exit(1);
+ }
bacpy(&cr->bdaddr, &bdaddr);
cr->type = ACL_LINK;
@@ -1839,8 +1859,10 @@ static void cmd_clkoff(int dev_id, int argc, char **argv)
}
cr = malloc(sizeof(*cr) + sizeof(struct hci_conn_info));
- if (!cr)
- return;
+ if (!cr) {
+ perror("Can't allocate memory");
+ exit(1);
+ }
bacpy(&cr->bdaddr, &bdaddr);
cr->type = ACL_LINK;
@@ -1912,8 +1934,10 @@ static void cmd_clock(int dev_id, int argc, char **argv)
}
cr = malloc(sizeof(*cr) + sizeof(struct hci_conn_info));
- if (!cr)
- return;
+ if (!cr) {
+ perror("Can't allocate memory");
+ exit(1);
+ }
bacpy(&cr->bdaddr, &bdaddr);
cr->type = ACL_LINK;