summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorPeter Meerwald-Stadler <pmeerw@pmeerw.net>2017-03-07 15:16:54 +0100
committerPeter Meerwald-Stadler <pmeerw@pmeerw.net>2017-03-09 13:51:51 +0100
commit4cfd544f2117fa3afe19874c92b7d063c69c44c5 (patch)
treec623248d8c307ac826c12a6473bae5661eed912e /src/modules
parenta8ce3ef844f460b1769e6472694ca4cf049dfd55 (diff)
raop: Fix potential NULL dereference
wath may be NULL, as suggested by Hajime Fujita Coverity ID: #1398156 setting val = NULL is not needed Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Cc: Hajime Fujita <crisp.fujita@nifty.com>
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/raop/raop-client.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/modules/raop/raop-client.c b/src/modules/raop/raop-client.c
index f23cf93a..e2cf04e8 100644
--- a/src/modules/raop/raop-client.c
+++ b/src/modules/raop/raop-client.c
@@ -1229,7 +1229,7 @@ static void rtsp_auth_cb(pa_rtsp_client *rtsp, pa_rtsp_state_t state, pa_rtsp_st
const char *current = NULL;
char space[] = " ";
char *token, *ath = NULL;
- char *publ, *wath, *mth, *val;
+ char *publ, *wath, *mth = NULL, *val;
char *realm = NULL, *nonce = NULL, *response = NULL;
char comma[] = ",";
@@ -1244,19 +1244,18 @@ static void rtsp_auth_cb(pa_rtsp_client *rtsp, pa_rtsp_state_t state, pa_rtsp_st
goto fail;
}
- if (wath)
+ if (wath) {
mth = pa_split(wath, space, &current);
- while ((token = pa_split(wath, comma, &current))) {
- val = NULL;
- if ((val = strstr(token, "="))) {
- if (NULL == realm && val > strstr(token, "realm"))
- realm = pa_xstrdup(val + 2);
- else if (NULL == nonce && val > strstr(token, "nonce"))
- nonce = pa_xstrdup(val + 2);
- val = NULL;
- }
+ while ((token = pa_split(wath, comma, &current))) {
+ if ((val = strstr(token, "="))) {
+ if (NULL == realm && val > strstr(token, "realm"))
+ realm = pa_xstrdup(val + 2);
+ else if (NULL == nonce && val > strstr(token, "nonce"))
+ nonce = pa_xstrdup(val + 2);
+ }
- pa_xfree(token);
+ pa_xfree(token);
+ }
}
if (pa_safe_streq(mth, "Basic") && realm) {