[FFmpeg-devel,v2] avformat/sapdec: check av_strdup() return value

Submitted by Steven Liu on Oct. 10, 2019, 5:27 a.m.

Details

Message ID 20191010052745.4262-1-lq@chinaffmpeg.org
State Accepted
Commit 9f023017abedb56ed7cae9cdd888e05db7114c20
Headers show

Commit Message

Steven Liu Oct. 10, 2019, 5:27 a.m.
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavformat/sapdec.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Michael Niedermayer Oct. 11, 2019, 7:37 p.m.
On Thu, Oct 10, 2019 at 01:27:45PM +0800, Steven Liu wrote:
> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> ---
>  libavformat/sapdec.c | 4 ++++
>  1 file changed, 4 insertions(+)

probably ok

thx

[...]

Patch hide | download patch | download mbox

diff --git a/libavformat/sapdec.c b/libavformat/sapdec.c
index eddeddeaea..f8bc0d281c 100644
--- a/libavformat/sapdec.c
+++ b/libavformat/sapdec.c
@@ -142,6 +142,10 @@  static int sap_read_header(AVFormatContext *s)
         }
 
         sap->sdp = av_strdup(&recvbuf[pos]);
+        if (!sap->sdp) {
+            ret = AVERROR(ENOMEM);
+            goto fail;
+        }
         break;
     }