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

Steven Liu lq at chinaffmpeg.org
Thu Oct 10 08:27:45 EEST 2019


Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
---
 libavformat/sapdec.c | 4 ++++
 1 file changed, 4 insertions(+)

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;
     }
 
-- 
2.15.1





More information about the ffmpeg-devel mailing list