Cleanup RSSI monitor cmd if it fails
Bug
22826644
Change-Id: Iaca8201ea32d051bb2afd34e28257fc828908599
Signed-off-by: Ashwin <ashwin.bhat@broadcom.com>
wifi_handle handle = getWifiHandle(iface);
SetRSSIMonitorCommand *cmd = new SetRSSIMonitorCommand(id, iface, max_rssi, min_rssi, eh);
wifi_register_cmd(handle, id, cmd);
- return (wifi_error)cmd->start();
+
+ wifi_error result = (wifi_error)cmd->start();
+ if (result != WIFI_SUCCESS) {
+ wifi_unregister_cmd(handle, id);
+ }
+ return result;
}