Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix segfaults when dev is null. #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/librtlsdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,10 +840,10 @@ int rtlsdr_write_eeprom(rtlsdr_dev_t *dev, uint8_t *data, uint8_t offset, uint16
int r = 0;
int i;
uint8_t cmd[2];
rtlsdr_set_i2c_repeater(dev, 0);

if (!dev)
return -1;
rtlsdr_set_i2c_repeater(dev, 0);

if ((len + offset) > 256)
return -2;
Expand Down Expand Up @@ -878,10 +878,10 @@ int rtlsdr_read_eeprom(rtlsdr_dev_t *dev, uint8_t *data, uint8_t offset, uint16_
{
int r = 0;
int i;
rtlsdr_set_i2c_repeater(dev, 0);

if (!dev)
return -1;
rtlsdr_set_i2c_repeater(dev, 0);

if ((len + offset) > 256)
return -2;
Expand Down Expand Up @@ -934,10 +934,10 @@ uint32_t rtlsdr_get_center_freq(rtlsdr_dev_t *dev)
int rtlsdr_set_freq_correction(rtlsdr_dev_t *dev, int ppm)
{
int r = 0;
rtlsdr_set_i2c_repeater(dev, 0);

if (!dev)
return -1;
rtlsdr_set_i2c_repeater(dev, 0);

if (dev->corr == ppm)
return -2;
Expand Down Expand Up @@ -1269,10 +1269,10 @@ int rtlsdr_get_direct_sampling(rtlsdr_dev_t *dev)
int rtlsdr_set_offset_tuning(rtlsdr_dev_t *dev, int on)
{
int r = 0;
rtlsdr_set_i2c_repeater(dev, 0);

if (!dev)
return -1;
rtlsdr_set_i2c_repeater(dev, 0);

if ((dev->tuner_type == RTLSDR_TUNER_R820T) ||
(dev->tuner_type == RTLSDR_TUNER_R828D))
Expand Down