diff mbox series

[FFmpeg-devel] libavforamt/udp: Memory allocation failure check

Message ID 20230303123139.1107008-1-jack.wgm@gmail.com
State Accepted
Commit 05ea0457fc50555287ecc2e304bc42dd0e05481b
Headers show
Series [FFmpeg-devel] libavforamt/udp: Memory allocation failure check | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

jackarain March 3, 2023, 12:31 p.m. UTC
Signed-off-by: jackarain <jack.wgm@gmail.com>
---
 libavformat/udp.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Marton Balint March 8, 2023, 10:44 p.m. UTC | #1
On Fri, 3 Mar 2023, jackarain wrote:

> Signed-off-by: jackarain <jack.wgm@gmail.com>
> ---
> libavformat/udp.c | 4 ++++
> 1 file changed, 4 insertions(+)

Thanks, will apply.

Regards,
Marton

>
> 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)
> -- 
> 2.39.2
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
diff mbox series

Patch

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)