diff mbox

[FFmpeg-devel,FFmpeg-devel,1/2] avformat/mov: set correct error code in mov_read_custom

Message ID 1511752376-25246-1-git-send-email-bianpan2016@163.com
State Accepted
Commit 3f81259f337ba57ab1a722566c8d8122dc705823
Headers show

Commit Message

Pan Bian Nov. 27, 2017, 3:12 a.m. UTC
In function mov_read_custom(), it returns 0 on the path that av_malloc()
returns a NULL pointer. 0 indicates success. An error code should be
assigned to ret.

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 libavformat/mov.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer Nov. 28, 2017, 8:36 p.m. UTC | #1
On Mon, Nov 27, 2017 at 11:12:56AM +0800, Pan Bian wrote:
> In function mov_read_custom(), it returns 0 on the path that av_malloc()
> returns a NULL pointer. 0 indicates success. An error code should be
> assigned to ret.
> 
> Signed-off-by: Pan Bian <bianpan2016@163.com>
> ---
>  libavformat/mov.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

will apply

thanks

[...]
diff mbox

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index ddb1e59..d25071b 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4177,8 +4177,10 @@  static int mov_read_custom(MOVContext *c, AVIOContext *pb, MOVAtom atom)
             break;
 
         *p = av_malloc(len + 1);
-        if (!*p)
+        if (!*p) {
+            ret = AVERROR(ENOMEM);
             break;
+        }
         ret = ffio_read_size(pb, *p, len);
         if (ret < 0) {
             av_freep(p);