raop: Fix resource leaks

Coverity ID: #1398158, #1398159

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
This commit is contained in:
Peter Meerwald-Stadler 2017-02-22 15:21:00 +01:00
parent 4bb25292f8
commit 4d7922d091

View file

@ -1228,7 +1228,7 @@ static void rtsp_auth_cb(pa_rtsp_client *rtsp, pa_rtsp_state_t state, pa_rtsp_st
static bool waiting = false; static bool waiting = false;
const char *current = NULL; const char *current = NULL;
char space[] = " "; char space[] = " ";
char *token,*ath = NULL; char *token, *ath = NULL;
char *publ, *wath, *mth, *val; char *publ, *wath, *mth, *val;
char *realm = NULL, *nonce = NULL, *response = NULL; char *realm = NULL, *nonce = NULL, *response = NULL;
char comma[] = ","; char comma[] = ",";
@ -1265,9 +1265,6 @@ static void rtsp_auth_cb(pa_rtsp_client *rtsp, pa_rtsp_state_t state, pa_rtsp_st
pa_raop_basic_response(DEFAULT_USER_NAME, c->password, &response); pa_raop_basic_response(DEFAULT_USER_NAME, c->password, &response);
ath = pa_sprintf_malloc("Basic %s", ath = pa_sprintf_malloc("Basic %s",
response); response);
pa_xfree(response);
pa_xfree(realm);
} else if (pa_safe_streq(mth, "Digest")) { } else if (pa_safe_streq(mth, "Digest")) {
rtrim_char(realm, '\"'); rtrim_char(realm, '\"');
rtrim_char(nonce, '\"'); rtrim_char(nonce, '\"');
@ -1276,17 +1273,18 @@ static void rtsp_auth_cb(pa_rtsp_client *rtsp, pa_rtsp_state_t state, pa_rtsp_st
ath = pa_sprintf_malloc("Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"*\", response=\"%s\"", ath = pa_sprintf_malloc("Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"*\", response=\"%s\"",
DEFAULT_USER_NAME, realm, nonce, DEFAULT_USER_NAME, realm, nonce,
response); response);
pa_xfree(response);
pa_xfree(realm);
pa_xfree(nonce);
} else { } else {
pa_log_error("unsupported authentication method: %s", mth); pa_log_error("unsupported authentication method: %s", mth);
pa_xfree(realm);
pa_xfree(nonce);
pa_xfree(wath); pa_xfree(wath);
pa_xfree(mth); pa_xfree(mth);
goto error; goto error;
} }
pa_xfree(response);
pa_xfree(realm);
pa_xfree(nonce);
pa_xfree(wath); pa_xfree(wath);
pa_xfree(mth); pa_xfree(mth);