[FFmpeg-devel,v1,2/8] avformat/hlsenc: check av_strdup() return value

Submitted by Steven Liu on Oct. 10, 2019, 3:40 a.m.

Details

Message ID 20191010034011.1205-2-lq@chinaffmpeg.org
State New
Headers show

Commit Message

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

Patch hide | download patch | download mbox

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index cd4320114d..eacc438e30 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1884,6 +1884,9 @@  static int parse_variant_stream_mapstring(AVFormatContext *s)
      * agroup: is key to specify audio group. A string can be given as value.
      */
     p = av_strdup(hls->var_stream_map);
+    if (!p)
+        return AVERROR(ENOMEM);
+
     q = p;
     while (av_strtok(q, " \t", &saveptr1)) {
         q = NULL;