Don't call hackrf_exit if hackrf_init failed;
don't call hackrf_close if hackrf_open failed.
This commit is contained in:
parent
699576f3de
commit
8b6239fab7
|
|
@ -131,15 +131,12 @@ bool hackRFOpen()
|
|||
status = hackrf_init();
|
||||
if (status != 0) {
|
||||
fprintf(stderr, "HackRF: hackrf_init failed with code %d\n", status);
|
||||
hackrf_close(HackRF.device);
|
||||
hackrf_exit();
|
||||
return false;
|
||||
}
|
||||
|
||||
status = hackrf_open(&HackRF.device);
|
||||
if (status != 0) {
|
||||
fprintf(stderr, "HackRF: hackrf_open failed with code %d\n", status);
|
||||
hackrf_close(HackRF.device);
|
||||
hackrf_exit();
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue