diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-12-26 14:59:29 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-12-26 14:59:29 +0100 |
commit | f7da4b1cf15988551bb5158d5a84c14a2db4bf9f (patch) | |
tree | 67ce90d616f6489c4f0f43e71b9c1f4a321b198f | |
parent | 0704c44d68704df63eccd5579e66e5f218a378a6 (diff) | |
download | ffmpeg-f7da4b1cf15988551bb5158d5a84c14a2db4bf9f.tar.gz |
avformat/rtsp: Use av_freep() to avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/rtsp.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index e5fc123ba7..7276b79407 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -652,10 +652,10 @@ int ff_sdp_parse(AVFormatContext *s, const char *content) } for (i = 0; i < s1->nb_default_include_source_addrs; i++) - av_free(s1->default_include_source_addrs[i]); + av_freep(&s1->default_include_source_addrs[i]); av_freep(&s1->default_include_source_addrs); for (i = 0; i < s1->nb_default_exclude_source_addrs; i++) - av_free(s1->default_exclude_source_addrs[i]); + av_freep(&s1->default_exclude_source_addrs[i]); av_freep(&s1->default_exclude_source_addrs); rt->p = av_malloc_array(rt->nb_rtsp_streams + 1, sizeof(struct pollfd) * 2); @@ -714,23 +714,23 @@ void ff_rtsp_close_streams(AVFormatContext *s) rtsp_st->dynamic_handler->free( rtsp_st->dynamic_protocol_context); for (j = 0; j < rtsp_st->nb_include_source_addrs; j++) - av_free(rtsp_st->include_source_addrs[j]); + av_freep(&rtsp_st->include_source_addrs[j]); av_freep(&rtsp_st->include_source_addrs); for (j = 0; j < rtsp_st->nb_exclude_source_addrs; j++) - av_free(rtsp_st->exclude_source_addrs[j]); + av_freep(&rtsp_st->exclude_source_addrs[j]); av_freep(&rtsp_st->exclude_source_addrs); - av_free(rtsp_st); + av_freep(&rtsp_st); } } - av_free(rt->rtsp_streams); + av_freep(&rt->rtsp_streams); if (rt->asf_ctx) { avformat_close_input(&rt->asf_ctx); } if (CONFIG_RTPDEC && rt->ts) avpriv_mpegts_parse_close(rt->ts); - av_free(rt->p); - av_free(rt->recvbuf); + av_freep(&rt->p); + av_freep(&rt->recvbuf); } int ff_rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st) @@ -1158,7 +1158,7 @@ start: if (content_ptr) *content_ptr = content; else - av_free(content); + av_freep(&content); if (request) { char buf[1024]; @@ -1889,7 +1889,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, p[max_p].fd = fds[fdsidx]; p[max_p++].events = POLLIN; } - av_free(fds); + av_freep(&fds); } } n = poll(p, max_p, POLL_TIMEOUT_MS); @@ -2221,7 +2221,7 @@ static int sdp_read_header(AVFormatContext *s) content[size] ='\0'; err = ff_sdp_parse(s, content); - av_free(content); + av_freep(&content); if (err) goto fail; /* open each RTP stream */ |