diff options
author | Víctor Manuel Jáquez Leal <vjaquez@igalia.com> | 2017-08-08 15:49:27 +0200 |
---|---|---|
committer | Víctor Manuel Jáquez Leal <vjaquez@igalia.com> | 2017-08-24 13:04:22 +0200 |
commit | ec99a8e9f3a55190f5943060ad1934fb55fbd67e (patch) | |
tree | cb2afd4e0dca94c5fb58c7015e6350917e99374b | |
parent | 99fe63063d83a73baec43ad6c782ce0f38664f38 (diff) |
libs: decoder: h265: check for null
Coverity scan bug:
Dereference after null check: Either the check against null is
unnecessary, or there may be a null pointer dereference.
While looking for hte lowest poc, according to rest of the code, the
picture in the dbp (decoded picture buffer) might be NULL, thus we
could check for a NULL picture before assigned as found.
Also, split a comma operator because it is considered as a bad
practice because it possible side effects.
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapidecoder_h265.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h265.c b/gst-libs/gst/vaapi/gstvaapidecoder_h265.c index 37228256..f1e55464 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_h265.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_h265.c @@ -717,8 +717,10 @@ dpb_find_lowest_poc (GstVaapiDecoderH265 * decoder, GstVaapiPictureH265 *const picture = priv->dpb[i]->buffer; if (picture && !picture->output_needed) continue; - if (!found_picture || found_picture->poc > picture->poc) - found_picture = picture, found_index = i; + if (picture && (!found_picture || found_picture->poc > picture->poc)) { + found_picture = picture; + found_index = i; + } } if (found_picture_ptr) |