From 82bf41f3abce4a13e7c6ad1606eb708f371de87f Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Fri, 3 Apr 2020 17:03:38 +0200 Subject: avformat: Replace ffurl_close() by ffurl_closep() where appropriate It avoids leaving dangling pointers behind in memory. Also remove redundant checks for whether the URLContext to be closed is already NULL. Reviewed-by: Anton Khirnov Signed-off-by: Andreas Rheinhardt --- libavformat/rtmpproto.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'libavformat/rtmpproto.c') diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index e23426b770..d9741bc622 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -2511,7 +2511,7 @@ static int rtmp_close(URLContext *h) free_tracked_methods(rt); av_freep(&rt->flv_data); - ffurl_close(rt->stream); + ffurl_closep(&rt->stream); return ret; } @@ -2824,8 +2824,7 @@ reconnect: if (rt->do_reconnect) { int i; - ffurl_close(rt->stream); - rt->stream = NULL; + ffurl_closep(&rt->stream); rt->do_reconnect = 0; rt->nb_invokes = 0; for (i = 0; i < 2; i++) -- cgit v1.2.3