[libav-commits] mxfdec: fix NULL checking in mxf_get_sorted_table_segments()

Xi Wang git at libav.org
Sat Jan 5 03:02:11 CET 2013


Module: libav
Branch: master
Commit: 3b81bba3bc5aca98d891cb377d27566de4745225

Author:    Xi Wang <xi.wang at gmail.com>
Committer: Derek Buitenhuis <derek.buitenhuis at gmail.com>
Date:      Fri Jan  4 21:09:47 2013 +0000

mxfdec: fix NULL checking in mxf_get_sorted_table_segments()

The following out-of-memory check is broken.

    *sorted_segments  = av_mallocz(...);
    if (!sorted_segments) { ... }

The correct NULL check should use *sorted_segments.

Signed-off-by: Xi Wang <xi.wang at gmail.com>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>

---

 libavformat/mxfdec.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 61b9c68..18f7b26 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -955,7 +955,7 @@ static int mxf_get_sorted_table_segments(MXFContext *mxf, int *nb_sorted_segment
 
     *sorted_segments  = av_mallocz(nb_segments * sizeof(**sorted_segments));
     unsorted_segments = av_mallocz(nb_segments * sizeof(*unsorted_segments));
-    if (!sorted_segments || !unsorted_segments) {
+    if (!*sorted_segments || !unsorted_segments) {
         av_freep(sorted_segments);
         av_free(unsorted_segments);
         return AVERROR(ENOMEM);



More information about the libav-commits mailing list