Search Linux Wireless

[PATCH] iw: Static analyser fixes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Johannes,

Subject: [PATCH] iw: Static analyser fixes

Signed-off-by: Amit Khatri <amit.khatri@xxxxxxxxxxx>
Signed-off-by: Rahul Jain <rahul.jain@xxxxxxxxxxx>
---
 cqm.c   | 2 ++
 event.c | 6 +++++-
 iw.c    | 2 +-
 scan.c  | 2 ++
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/cqm.c b/cqm.c
index 65876af..bf60401 100644
--- a/cqm.c
+++ b/cqm.c
@@ -34,6 +34,8 @@ static int iw_cqm_rssi(struct nl80211_state *state, struct nl_cb *cb,
 
 	/* connection quality monitor attributes */
 	cqm = nlmsg_alloc();
+	if(!cqm)
+		return -ENOMEM;
 
 	NLA_PUT_U32(cqm, NL80211_ATTR_CQM_RSSI_THOLD, thold);
 	NLA_PUT_U32(cqm, NL80211_ATTR_CQM_RSSI_HYST, hyst);
diff --git a/event.c b/event.c
index f73e078..06d236b 100644
--- a/event.c
+++ b/event.c
@@ -49,8 +49,10 @@ static void print_frame(struct print_event_args *args, struct nlattr *attr)
 	char macbuf[6*3];
 	uint16_t tmp;
 
-	if (!attr)
+	if (!attr) {
 		printf(" [no frame]");
+		goto out;
+	}
 
 	frame = nla_data(attr);
 	len = nla_len(attr);
@@ -97,6 +99,8 @@ static void print_frame(struct print_event_args *args, struct nlattr *attr)
 	for (i = 0; i < len; i++)
 		printf(" %.02x", frame[i]);
 	printf("]");
+ out:
+	;  /*empty statement to avoid compiler error */
 }
 
 static void parse_cqm_event(struct nlattr **attrs)
diff --git a/iw.c b/iw.c
index dc99566..1e913b6 100644
--- a/iw.c
+++ b/iw.c
@@ -477,8 +477,8 @@ static int __handle_cmd(struct nl80211_state *state, enum id_input idby,
 	while (err > 0)
 		nl_recvmsgs(state->nl_sock, cb);
  out:
-	nl_cb_put(cb);
  out_free_msg:
+	nl_cb_put(cb);
 	nlmsg_free(msg);
 	return err;
  nla_put_failure:
diff --git a/scan.c b/scan.c
index bf39f34..5483c1d 100644
--- a/scan.c
+++ b/scan.c
@@ -409,6 +409,8 @@ static int handle_scan(struct nl80211_state *state,
 				break;
 			}
 		case DONE:
+			nlmsg_free(ssids);
+			nlmsg_free(freqs);
 			return 1;
 		case FREQ:
 			freq = strtoul(argv[i], &eptr, 10);
-- 
1.9.1��.n��������+%������w��{.n�����{���zW����ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux