summaryrefslogtreecommitdiff
path: root/libavutil/opt.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavutil/opt.c')
-rw-r--r--libavutil/opt.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavutil/opt.c b/libavutil/opt.c
index af413d4b35..92d1e39d95 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -162,7 +162,7 @@ static int set_string(void *obj, const AVOption *o, const char *val, uint8_t **d
{
av_freep(dst);
*dst = av_strdup(val);
- return 0;
+ return *dst ? 0 : AVERROR(ENOMEM);
}
#define DEFAULT_NUMVAL(opt) ((opt->type == AV_OPT_TYPE_INT64 || \
@@ -711,7 +711,7 @@ int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
*out_val = av_strdup(*(uint8_t**)dst);
else
*out_val = av_strdup("");
- return 0;
+ return *out_val ? 0 : AVERROR(ENOMEM);
case AV_OPT_TYPE_BINARY:
len = *(int*)(((uint8_t *)dst) + sizeof(uint8_t *));
if ((uint64_t)len*2 + 1 > INT_MAX)
@@ -757,7 +757,7 @@ int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
if (ret >= sizeof(buf))
return AVERROR(EINVAL);
*out_val = av_strdup(buf);
- return 0;
+ return *out_val ? 0 : AVERROR(ENOMEM);
}
static int get_number(void *obj, const char *name, const AVOption **o_out, double *num, int *den, int64_t *intnum,