summaryrefslogtreecommitdiff
path: root/libavutil/opt.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-02-25 12:32:49 +0100
committerAnton Khirnov <anton@khirnov.net>2013-04-04 07:51:53 +0200
commitbcc94328980e6c56546792ab08b0756abdce310b (patch)
treeb321e64778ecccf04d773e6d82d3e91276a3c069 /libavutil/opt.c
parentdfcbe8cbd78bb682f0fdfd4d281ab825ab481caf (diff)
opt: check the return values of av_get_token for ENOMEM.
Diffstat (limited to 'libavutil/opt.c')
-rw-r--r--libavutil/opt.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavutil/opt.c b/libavutil/opt.c
index 2cc6f6ce34..f2b947337e 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);