diff options
author | Vinita S. Maloo <vmaloo@codeaurora.org> | 2021-03-26 14:07:54 +0530 |
---|---|---|
committer | Vinita S. Maloo <vmaloo@codeaurora.org> | 2021-04-02 11:11:50 +0530 |
commit | e025a1ceadee69a7abda5a91face873eba191299 (patch) | |
tree | 4089fe525e761a5808dc147b77868159c7735f06 | |
parent | dc304be4ce897998c8fc844ee61a4fce277e29c2 (diff) |
wpa_supplicant_8_lib: Remove unnecessary initialization and malloc
Cleanup code in parse_get_feature_info API to remove
unnecessary initialization and malloc.
Change-Id: I10e340ba74893ee90510b664d7697cf854c984f8
CRs-Fixed: 2911912
-rw-r--r-- | qcwcn/wpa_supplicant_8_lib/driver_cmd_nl80211.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/qcwcn/wpa_supplicant_8_lib/driver_cmd_nl80211.c b/qcwcn/wpa_supplicant_8_lib/driver_cmd_nl80211.c index 7c34b1c..4902cd8 100644 --- a/qcwcn/wpa_supplicant_8_lib/driver_cmd_nl80211.c +++ b/qcwcn/wpa_supplicant_8_lib/driver_cmd_nl80211.c @@ -529,24 +529,18 @@ parse_beacon_ies: } static int parse_get_feature_info(struct resp_info *info, struct nlattr *vendata, - int datalen) + int datalen) { struct nlattr *tb_vendor[NUM_QCA_WLAN_VENDOR_FEATURES + 1]; struct nlattr *attr; - char *result = NULL; nla_parse(tb_vendor, NUM_QCA_WLAN_VENDOR_FEATURES, vendata, datalen, NULL); attr = tb_vendor[QCA_WLAN_VENDOR_ATTR_FEATURE_FLAGS]; if (attr) { - int length = snprintf( NULL, 0, "%d", nla_get_u32(attr)); - result = (char *)malloc(length + 1); - if (result != NULL) { - memset(result, 0, length + 1); - snprintf(result, length + 1, "%d", nla_get_u32(attr)); - snprintf(info->reply_buf, info->reply_buf_len, - "%s", result); - wpa_printf(MSG_DEBUG, "%s: driver supported feature info = %s", __func__, result); - } + snprintf(info->reply_buf, info->reply_buf_len, "%u", + nla_get_u32(attr)); + wpa_printf(MSG_DEBUG, "%s: driver supported feature info = %s", + __func__, info->reply_buf); } else { snprintf(info->reply_buf, info->reply_buf_len, "FAIL"); return -1; |