From c0eed06b696725001f8c24233f6f7739c0925526 Mon Sep 17 00:00:00 2001 From: f4exb Date: Wed, 14 Feb 2018 19:59:19 +0100 Subject: [PATCH] Web API and related: fixed memory leaks (3) --- sdrgui/webapi/webapiadaptergui.cpp | 5 ++++- sdrsrv/webapi/webapiadaptersrv.cpp | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sdrgui/webapi/webapiadaptergui.cpp b/sdrgui/webapi/webapiadaptergui.cpp index 3b6b386ba..4cd81f288 100644 --- a/sdrgui/webapi/webapiadaptergui.cpp +++ b/sdrgui/webapi/webapiadaptergui.cpp @@ -828,11 +828,13 @@ int WebAPIAdapterGUI::devicesetDeviceSettingsPutPatch( { if (response.getTx() != 0) { + error.init(); *error.getMessage() = QString("Rx device found but Tx device requested"); return 400; } if (deviceSet->m_deviceSourceAPI->getHardwareId() != *response.getDeviceHwType()) { + error.init(); *error.getMessage() = QString("Device mismatch. Found %1 input").arg(deviceSet->m_deviceSourceAPI->getHardwareId()); return 400; } @@ -846,11 +848,13 @@ int WebAPIAdapterGUI::devicesetDeviceSettingsPutPatch( { if (response.getTx() == 0) { + error.init(); *error.getMessage() = QString("Tx device found but Rx device requested"); return 400; } else if (deviceSet->m_deviceSinkAPI->getHardwareId() != *response.getDeviceHwType()) { + error.init(); *error.getMessage() = QString("Device mismatch. Found %1 output").arg(deviceSet->m_deviceSinkAPI->getHardwareId()); return 400; } @@ -871,7 +875,6 @@ int WebAPIAdapterGUI::devicesetDeviceSettingsPutPatch( { error.init(); *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex); - return 404; } } diff --git a/sdrsrv/webapi/webapiadaptersrv.cpp b/sdrsrv/webapi/webapiadaptersrv.cpp index acb01fe0c..5db59276b 100644 --- a/sdrsrv/webapi/webapiadaptersrv.cpp +++ b/sdrsrv/webapi/webapiadaptersrv.cpp @@ -929,11 +929,13 @@ int WebAPIAdapterSrv::devicesetDeviceSettingsPutPatch( { if (response.getTx() != 0) { + error.init(); *error.getMessage() = QString("Rx device found but Tx device requested"); return 400; } if (deviceSet->m_deviceSourceAPI->getHardwareId() != *response.getDeviceHwType()) { + error.init(); *error.getMessage() = QString("Device mismatch. Found %1 input").arg(deviceSet->m_deviceSourceAPI->getHardwareId()); return 400; } @@ -947,11 +949,13 @@ int WebAPIAdapterSrv::devicesetDeviceSettingsPutPatch( { if (response.getTx() == 0) { + error.init(); *error.getMessage() = QString("Tx device found but Rx device requested"); return 400; } else if (deviceSet->m_deviceSinkAPI->getHardwareId() != *response.getDeviceHwType()) { + error.init(); *error.getMessage() = QString("Device mismatch. Found %1 output").arg(deviceSet->m_deviceSinkAPI->getHardwareId()); return 400; }