Skip to content

Commit

Permalink
Fix memory leak on aborted RTSP connection (#2699)
Browse files Browse the repository at this point in the history
  • Loading branch information
lionelnicolas committed Jun 14, 2021
1 parent f0b53b8 commit f00cf79
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion plugins/janus_streaming.c
Original file line number Diff line number Diff line change
Expand Up @@ -6489,8 +6489,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 @@ -6507,6 +6512,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

0 comments on commit f00cf79

Please sign in to comment.