This fixes a crash when an invalid URL is used. Signed-off-by: pkv <[email protected]>
@@ -341,11 +341,21 @@ static inline int connect_mpegts_url(struct ffmpeg_output *stream, bool is_rist)
if (err < 0)
goto fail;
+ else
+ stream->has_connected = true;
return 0;
fail:
- if (uc)
+ stream->has_connected = false;
+
+ if (uc) {
+ if (is_rist)
+ librist_close(uc);
+ libsrt_close(uc);
av_freep(&uc->priv_data);
+ }
av_freep(&uc);
#if HAVE_WINSOCK2_H
WSACleanup();
@@ -120,6 +120,7 @@ struct ffmpeg_output {
pthread_t start_stop_thread;
pthread_mutex_t start_stop_mutex;
volatile bool start_stop_thread_active;
+ bool has_connected;
#endif
};