if( cv && cv->msg )
nlmsg_free(cv->msg);
+
+ if( cv )
+ {
+ cv->cb = NULL;
+ cv->msg = NULL;
+ }
}
static struct nl80211_msg_conveyor * nl80211_msg(const char *ifname, int cmd, int flags)
int nl80211_get_noise(const char *ifname, int *buf)
{
+ int rv = -1;
struct nl80211_msg_conveyor *req, *res;
struct nlattr *si[NL80211_SURVEY_INFO_MAX + 1];
if( res->attr[NL80211_ATTR_SURVEY_INFO] )
{
if( !nla_parse_nested(si, NL80211_SURVEY_INFO_MAX,
- res->attr[NL80211_ATTR_SURVEY_INFO], sp) )
+ res->attr[NL80211_ATTR_SURVEY_INFO], sp) &&
+ si[NL80211_SURVEY_INFO_NOISE] )
{
*buf = (int8_t)nla_get_u8(si[NL80211_SURVEY_INFO_NOISE]);
- return 0;
+ rv = 0;
}
}
nl80211_free(res);
nl80211_free(req);
}
- return -1;
+ return rv;
}
int nl80211_get_quality(const char *ifname, int *buf)