aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/opt.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2012-12-08 18:41:06 +0100
committerStefano Sabatini <stefasab@gmail.com>2012-12-08 19:53:03 +0100
commit129d73715084620f52dd507aeab29eb8e1da490e (patch)
tree757d76d332c2df9a9f66f2616fbea57f48a3560d /libavutil/opt.c
parente5550c0d0971e393ba221cd69506acd2c2dab89c (diff)
downloadffmpeg-129d73715084620f52dd507aeab29eb8e1da490e.tar.gz
lavu/opt: make av_opt_query_ranges_default() return a meaningful error code
Diffstat (limited to 'libavutil/opt.c')
-rw-r--r--libavutil/opt.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavutil/opt.c b/libavutil/opt.c
index 098dba378e..b8ad36f1d7 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -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 = av_mallocz(sizeof(*range));
const AVOption *field = av_opt_find(obj, key, NULL, 0, flags);
+ int ret;
*ranges_arg = NULL;
- if (!ranges || !range || !range_array || !field)
+ if (!ranges || !range || !range_array || !field) {
+ ret = AVERROR(ENOMEM);
goto fail;
+ }
ranges->range = range_array;
ranges->range[0] = range;
@@ -1266,6 +1269,7 @@ int av_opt_query_ranges_default(AVOptionRanges **ranges_arg, void *obj, const ch
range->value_max = INT_MAX/8;
break;
default:
+ ret = AVERROR(ENOSYS);
goto fail;
}
@@ -1274,7 +1278,7 @@ int av_opt_query_ranges_default(AVOptionRanges **ranges_arg, void *obj, const ch
fail:
av_free(ranges);
av_free(range);
- return -1;
+ return ret;
}
void av_opt_freep_ranges(AVOptionRanges **rangesp)