Deep redesign: fixed BladeRF plugin segfault when no device is connected

This commit is contained in:
f4exb 2015-08-30 13:03:27 +02:00
parent 4832a5afd8
commit 3e5a556cf7
1 changed files with 5 additions and 2 deletions

View File

@ -51,7 +51,7 @@ void BlderfPlugin::initPlugin(PluginAPI* pluginAPI)
PluginInterface::SampleSourceDevices BlderfPlugin::enumSampleSources()
{
SampleSourceDevices result;
struct bladerf_devinfo *devinfo;
struct bladerf_devinfo *devinfo = 0;
int count = bladerf_get_device_list(&devinfo);
@ -64,7 +64,10 @@ PluginInterface::SampleSourceDevices BlderfPlugin::enumSampleSources()
result.append(SampleSourceDevice(displayedName, "org.osmocom.sdr.samplesource.bladerf", s.final()));
}
bladerf_free_device_list(devinfo); // Valgrind memcheck
if (devinfo)
{
bladerf_free_device_list(devinfo); // Valgrind memcheck
}
return result;
}