summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/opt.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavutil/opt.c b/libavutil/opt.c
index ab73913a39..0e7a3a85bb 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -1032,9 +1032,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);