LMSDevice: LMS_GetDeviceList() may return a negative number

Change-Id: I855bd8ea6d9cb0f285f4dbbf3bcd09bff4e71044
Fixes: CID#240718
This commit is contained in:
Vadim Yanitskiy 2021-10-25 00:30:27 +03:00
parent a686277c72
commit 019d698126
1 changed files with 4 additions and 3 deletions

View File

@ -277,11 +277,12 @@ int LMSDevice::open(const std::string &args, int ref, bool swap_channels)
LMS_RegisterLogHandler(&lms_log_callback); LMS_RegisterLogHandler(&lms_log_callback);
if ((n = LMS_GetDeviceList(NULL)) < 0) if ((rc = LMS_GetDeviceList(NULL)) < 0)
LOGC(DDEV, ERROR) << "LMS_GetDeviceList(NULL) failed"; LOGC(DDEV, ERROR) << "LMS_GetDeviceList(NULL) failed";
LOGC(DDEV, INFO) << "Devices found: " << n; LOGC(DDEV, INFO) << "Devices found: " << rc;
if (n < 1) if (rc < 1)
return -1; return -1;
n = rc;
info_list = new lms_info_str_t[n]; info_list = new lms_info_str_t[n];