Commit bcc94328 authored by Anton Khirnov's avatar Anton Khirnov

opt: check the return values of av_get_token for ENOMEM.

parent dfcbe8cb
...@@ -562,9 +562,16 @@ static int parse_key_value_pair(void *ctx, const char **buf, ...@@ -562,9 +562,16 @@ static int parse_key_value_pair(void *ctx, const char **buf,
char *val; char *val;
int ret; int ret;
if (!key)
return AVERROR(ENOMEM);
if (*key && strspn(*buf, key_val_sep)) { if (*key && strspn(*buf, key_val_sep)) {
(*buf)++; (*buf)++;
val = av_get_token(buf, pairs_sep); val = av_get_token(buf, pairs_sep);
if (!val) {
av_freep(&key);
return AVERROR(ENOMEM);
}
} else { } else {
av_log(ctx, AV_LOG_ERROR, "Missing key or no key/value separator found after key '%s'\n", key); av_log(ctx, AV_LOG_ERROR, "Missing key or no key/value separator found after key '%s'\n", key);
av_free(key); av_free(key);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment