[FFmpeg-cvslog] opt: check the return values of av_get_token for ENOMEM.
Anton Khirnov
git at videolan.org
Thu Apr 4 13:06:27 CEST 2013
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Mon Feb 25 12:32:49 2013 +0100| [bcc94328980e6c56546792ab08b0756abdce310b] | committer: Anton Khirnov
opt: check the return values of av_get_token for ENOMEM.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bcc94328980e6c56546792ab08b0756abdce310b
---
libavutil/opt.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/libavutil/opt.c b/libavutil/opt.c
index 2cc6f6c..f2b9473 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -562,9 +562,16 @@ static int parse_key_value_pair(void *ctx, const char **buf,
char *val;
int ret;
+ if (!key)
+ return AVERROR(ENOMEM);
+
if (*key && strspn(*buf, key_val_sep)) {
(*buf)++;
val = av_get_token(buf, pairs_sep);
+ if (!val) {
+ av_freep(&key);
+ return AVERROR(ENOMEM);
+ }
} else {
av_log(ctx, AV_LOG_ERROR, "Missing key or no key/value separator found after key '%s'\n", key);
av_free(key);
More information about the ffmpeg-cvslog
mailing list