opt: check memory allocation
authorVittorio Giovara <vittorio.giovara@gmail.com>
Thu, 18 Dec 2014 19:26:57 +0000 (20:26 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 12 Feb 2015 16:10:35 +0000 (17:10 +0100)
Bug-Id: CID 1257771
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavutil/opt.c

index d873bd2..3143463 100644 (file)
@@ -143,6 +143,8 @@ static int set_string_binary(void *obj, const AVOption *o, const char *val, uint
     len /= 2;
 
     ptr = bin = av_malloc(len);
+    if (!ptr)
+        return AVERROR(ENOMEM);
     while (*val) {
         int a = hexchar2int(*val++);
         int b = hexchar2int(*val++);