diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-12-19 04:57:25 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-12-19 04:57:25 +0100 |
commit | 988d27b8029d9b4ccb13e792004cc8375b835eac (patch) | |
tree | 8931c74a18dcf3876f6db7569a7404b64ed5abab /libavutil/opt.c | |
parent | 76a8127a452f9e149a876c5fa6d6f0634e3b5b1e (diff) | |
parent | b1306823d0b3ae998c8e10ad832004eb13bdd93e (diff) | |
download | ffmpeg-988d27b8029d9b4ccb13e792004cc8375b835eac.tar.gz |
Merge commit 'b1306823d0b3ae998c8e10ad832004eb13bdd93e'
* commit 'b1306823d0b3ae998c8e10ad832004eb13bdd93e':
check memory errors from av_strdup()
Conflicts:
avprobe.c
libavformat/matroskaenc.c
libavutil/opt.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/opt.c')
-rw-r--r-- | libavutil/opt.c | 6 |
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, |