aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2017-10-03 21:40:22 -0300
committerJames Almer <jamrial@gmail.com>2017-10-03 21:40:22 -0300
commitc2916564d8e469e74074b3c8af325af8ac334a63 (patch)
tree7c5073cfde929f221dc4e5a9817e31130f8ddbd0 /libavformat
parent7c74efeaf89111d686f928cbf1fe20d9a768d31f (diff)
parent5263f464db5f2df74ddf712f6d1221b24475fa8e (diff)
downloadffmpeg-c2916564d8e469e74074b3c8af325af8ac334a63.tar.gz
Merge commit '5263f464db5f2df74ddf712f6d1221b24475fa8e'
* commit '5263f464db5f2df74ddf712f6d1221b24475fa8e': rtsp: Lazily allocate the pollfd array Merged-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/rtsp.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 7407014f5e..2d1df80ed0 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -670,7 +670,6 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
int ff_sdp_parse(AVFormatContext *s, const char *content)
{
- RTSPState *rt = s->priv_data;
const char *p;
int letter, i;
/* Some SDP lines, particularly for Realmedia or ASF RTSP streams,
@@ -717,8 +716,6 @@ int ff_sdp_parse(AVFormatContext *s, const char *content)
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);
- if (!rt->p) return AVERROR(ENOMEM);
return 0;
}
#endif /* CONFIG_RTPDEC */
@@ -1931,6 +1928,12 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
struct pollfd *p = rt->p;
int *fds = NULL, fdsnum, fdsidx;
+ if (!p) {
+ p = rt->p = av_malloc_array(2 * (rt->nb_rtsp_streams + 1), sizeof(struct pollfd));
+ if (!p)
+ return AVERROR(ENOMEM);
+ }
+
if (rt->rtsp_hd) {
tcp_fd = ffurl_get_file_handle(rt->rtsp_hd);
p[max_p].fd = tcp_fd;