summaryrefslogtreecommitdiff
path: root/libavformat/rtpproto.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-04-03 17:03:38 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-05-25 13:11:36 +0200
commit82bf41f3abce4a13e7c6ad1606eb708f371de87f (patch)
treea76e1dc947a8b2db0dbf821d5c8fcc5e61269a52 /libavformat/rtpproto.c
parentaf97c9865fe7a48b223e162eabce21cc180f305c (diff)
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 <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat/rtpproto.c')
-rw-r--r--libavformat/rtpproto.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index 1f0a82ac7e..ca63c165e4 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -363,10 +363,8 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
return 0;
fail:
- if (s->rtp_hd)
- ffurl_close(s->rtp_hd);
- if (s->rtcp_hd)
- ffurl_close(s->rtcp_hd);
+ ffurl_closep(&s->rtp_hd);
+ ffurl_closep(&s->rtcp_hd);
ffurl_closep(&s->fec_hd);
av_free(fec_protocol);
av_dict_free(&fec_opts);
@@ -506,8 +504,8 @@ static int rtp_close(URLContext *h)
ff_ip_reset_filters(&s->filters);
- ffurl_close(s->rtp_hd);
- ffurl_close(s->rtcp_hd);
+ ffurl_closep(&s->rtp_hd);
+ ffurl_closep(&s->rtcp_hd);
ffurl_closep(&s->fec_hd);
return 0;
}