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 memory leak on aborted RTSP connection #2699

Merged
Merged
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
10 changes: 9 additions & 1 deletion plugins/janus_streaming.c
Original file line number Diff line number Diff line change
Expand Up @@ -6480,8 +6480,13 @@ static int janus_streaming_rtsp_connect_to_server(janus_streaming_mountpoint *mp
int asport = 0, asport_rtcp = 0;
multiple_fds audio_fds = {-1, -1};

if(g_atomic_int_get(&mp->destroyed))
if(g_atomic_int_get(&mp->destroyed)) {
curl_easy_cleanup(curl);
g_free(curldata->buffer);
g_free(curldata);
return -8;
}

janus_mutex_lock(&mountpoints_mutex);
/* Parse both video and audio first before proceed to setup as curldata will be reused */
int vresult = -1;
Expand All @@ -6498,6 +6503,9 @@ static int janus_streaming_rtsp_connect_to_server(janus_streaming_mountpoint *mp

if(vresult == -1 && aresult == -1) {
/* Both audio and video failed? Give up... */
curl_easy_cleanup(curl);
g_free(curldata->buffer);
g_free(curldata);
return -7;
}

Expand Down