avformat/crypto: Use av_memdup()
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 2 Dec 2014 00:47:49 +0000 (01:47 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 2 Dec 2014 01:01:11 +0000 (02:01 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/crypto.c

index f3a85c7..c1754b0 100644 (file)
@@ -91,10 +91,9 @@ static int set_aes_arg(CryptoContext *c, uint8_t **buf, int *buf_len,
                    desc, default_buf_len, BLOCKSIZE);
             return AVERROR(EINVAL);
         }
-        *buf = av_malloc(default_buf_len);
+        *buf = av_memdup(default_buf, default_buf_len);
         if (!*buf)
             return AVERROR(ENOMEM);
-        memcpy(*buf, default_buf, default_buf_len);
         *buf_len = default_buf_len;
     } else if (*buf_len != BLOCKSIZE) {
         av_log(c, AV_LOG_ERROR,