diff options
author | Jun Zhao <barryjzhao@tencent.com> | 2019-10-12 00:46:05 +0800 |
---|---|---|
committer | Jun Zhao <barryjzhao@tencent.com> | 2019-10-18 09:56:51 +0800 |
commit | ed3c317deac933cfbc3c8f38a8930069b0847323 (patch) | |
tree | 527cee2a0cc73210577b583aa33ce51a0f972f49 | |
parent | 85e2b222e9105d6202a2ed843350065b5b37c81d (diff) | |
download | ffmpeg-streaming-ed3c317deac933cfbc3c8f38a8930069b0847323.zip ffmpeg-streaming-ed3c317deac933cfbc3c8f38a8930069b0847323.tar.gz |
fftools/ffmpeg_opt: add error handle if av_asprintf return null
add error handle if av_asprintf return null.
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
-rw-r--r-- | fftools/ffmpeg_opt.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index fa22eb3..af9a9a6 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -3008,6 +3008,8 @@ static int opt_old2new(void *optctx, const char *opt, const char *arg) { OptionsContext *o = optctx; char *s = av_asprintf("%s:%c", opt + 1, *opt); + if (!s) + return AVERROR(ENOMEM); int ret = parse_option(o, s, arg, options); av_free(s); return ret; @@ -3039,6 +3041,8 @@ static int opt_qscale(void *optctx, const char *opt, const char *arg) return parse_option(o, "q:v", arg, options); } s = av_asprintf("q%s", opt + 6); + if (!s) + return AVERROR(ENOMEM); ret = parse_option(o, s, arg, options); av_free(s); return ret; @@ -3084,6 +3088,8 @@ static int opt_timecode(void *optctx, const char *opt, const char *arg) { OptionsContext *o = optctx; char *tcr = av_asprintf("timecode=%s", arg); + if (!tcr) + return AVERROR(ENOMEM); int ret = parse_option(o, "metadata:g", tcr, options); if (ret >= 0) ret = av_dict_set(&o->g->codec_opts, "gop_timecode", arg, 0); |