Commit 129d7371 authored by Stefano Sabatini's avatar Stefano Sabatini

lavu/opt: make av_opt_query_ranges_default() return a meaningful error code

parent e5550c0d
...@@ -1228,11 +1228,14 @@ int av_opt_query_ranges_default(AVOptionRanges **ranges_arg, void *obj, const ch ...@@ -1228,11 +1228,14 @@ int av_opt_query_ranges_default(AVOptionRanges **ranges_arg, void *obj, const ch
AVOptionRange **range_array = av_mallocz(sizeof(void*)); AVOptionRange **range_array = av_mallocz(sizeof(void*));
AVOptionRange *range = av_mallocz(sizeof(*range)); AVOptionRange *range = av_mallocz(sizeof(*range));
const AVOption *field = av_opt_find(obj, key, NULL, 0, flags); const AVOption *field = av_opt_find(obj, key, NULL, 0, flags);
int ret;
*ranges_arg = NULL; *ranges_arg = NULL;
if (!ranges || !range || !range_array || !field) if (!ranges || !range || !range_array || !field) {
ret = AVERROR(ENOMEM);
goto fail; goto fail;
}
ranges->range = range_array; ranges->range = range_array;
ranges->range[0] = range; ranges->range[0] = range;
...@@ -1266,6 +1269,7 @@ int av_opt_query_ranges_default(AVOptionRanges **ranges_arg, void *obj, const ch ...@@ -1266,6 +1269,7 @@ int av_opt_query_ranges_default(AVOptionRanges **ranges_arg, void *obj, const ch
range->value_max = INT_MAX/8; range->value_max = INT_MAX/8;
break; break;
default: default:
ret = AVERROR(ENOSYS);
goto fail; goto fail;
} }
...@@ -1274,7 +1278,7 @@ int av_opt_query_ranges_default(AVOptionRanges **ranges_arg, void *obj, const ch ...@@ -1274,7 +1278,7 @@ int av_opt_query_ranges_default(AVOptionRanges **ranges_arg, void *obj, const ch
fail: fail:
av_free(ranges); av_free(ranges);
av_free(range); av_free(range);
return -1; return ret;
} }
void av_opt_freep_ranges(AVOptionRanges **rangesp) void av_opt_freep_ranges(AVOptionRanges **rangesp)
......
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