summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2019-02-21 16:47:29 +0200
committerGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2019-06-04 18:49:57 +0300
commita27f3b216008473d3150a3390aadedeaca868d63 (patch)
tree5fc4ca41dc1f0d21f9c1c50d5767b3f03bbb3eb1
parent88377dbe71b412c5e7487639889c0ff36871fb1b (diff)
rtlsdr: improve rtlsdr_set_output to handle NULL as the output string
Bug-AGL: SPEC-2473 Change-Id: I89f754bd83687159c3aecb3074cba4fcf16c7d37 Signed-off-by: George Kiagiadakis <george.kiagiadakis@collabora.com>
-rw-r--r--binding/radio_impl_rtlsdr.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/binding/radio_impl_rtlsdr.c b/binding/radio_impl_rtlsdr.c
index 109d3f3..044da0e 100644
--- a/binding/radio_impl_rtlsdr.c
+++ b/binding/radio_impl_rtlsdr.c
@@ -195,9 +195,8 @@ static int rtlsdr_init(void)
static void rtlsdr_set_output(const char *output)
{
// Save output for later use
- if(helper_output)
- free(helper_output);
- helper_output = strdup(output);
+ free(helper_output);
+ helper_output = output ? strdup(output) : NULL;
}
static uint32_t rtlsdr_get_frequency(void)