mxfdec: fix NULL checking in mxf_get_sorted_table_segments()
authorXi Wang <xi.wang@gmail.com>
Fri, 4 Jan 2013 21:09:47 +0000 (21:09 +0000)
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>
Sat, 5 Jan 2013 01:43:42 +0000 (20:43 -0500)
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@gmail.com>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
libavformat/mxfdec.c

index 61b9c687e1d5c550a7474e69db17692819b65434..18f7b26fa170cf21e5792777b2e7600a2cf23fbc 100644 (file)
@@ -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);