summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjackarain <jack.wgm@gmail.com>2023-03-03 20:31:39 +0800
committerMarton Balint <cus@passwd.hu>2023-03-08 23:14:09 +0100
commit05ea0457fc50555287ecc2e304bc42dd0e05481b (patch)
tree6f444fef7693788285d27e4d29acafd6109b2aec
parentf758d4fcb93b77115b6d971859f5bee56f8070b8 (diff)
avformat/udp: check for memory allocation failure when setting localaddr
Signed-off-by: jackarain <jack.wgm@gmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
-rw-r--r--libavformat/udp.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/udp.c b/libavformat/udp.c
index e8980b29d8..909213a467 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -740,6 +740,10 @@ static int udp_open(URLContext *h, const char *uri, int flags)
if (av_find_info_tag(buf, sizeof(buf), "localaddr", p)) {
av_freep(&s->localaddr);
s->localaddr = av_strdup(buf);
+ if (!s->localaddr) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
}
if (av_find_info_tag(buf, sizeof(buf), "sources", p)) {
if ((ret = ff_ip_parse_sources(h, buf, &s->filters)) < 0)