summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>2017-02-16 18:11:50 +0100
committerVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>2017-02-16 18:46:35 +0100
commitd6738f3f93ce19b6cd9d072b9a3e31264d9a9d59 (patch)
treec2950d0806d4ccfc18a41580b2ee0674432fd7ff
parent884e0bece269b5199006690f8f30221aa4d56be3 (diff)
libs: decoder: h264,h265 avoid uninitialized variable
Configuring GCC to verify possible usage of uninitialized variables, shows that found_index might be used without previous assignation. This patch assigns a initial value to found_index, also avoid a branching when returning the result value. https://bugzilla.gnome.org/show_bug.cgi?id=778782
-rw-r--r--gst-libs/gst/vaapi/gstvaapidecoder_h264.c12
-rw-r--r--gst-libs/gst/vaapi/gstvaapidecoder_h265.c4
2 files changed, 8 insertions, 8 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
index fbff9bc7..d4bd6dda 100644
--- a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
+++ b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
@@ -769,7 +769,7 @@ dpb_find_nearest_prev_poc (GstVaapiDecoderH264 * decoder,
{
GstVaapiDecoderH264Private *const priv = &decoder->priv;
GstVaapiPictureH264 *found_picture = NULL;
- guint i, j, found_index;
+ guint i, j, found_index = -1;
g_return_val_if_fail (picture != NULL, -1);
@@ -793,7 +793,7 @@ dpb_find_nearest_prev_poc (GstVaapiDecoderH264 * decoder,
if (found_picture_ptr)
*found_picture_ptr = found_picture;
- return found_picture ? found_index : -1;
+ return found_index;
}
/* Finds the picture with the lowest POC that needs to be output */
@@ -803,7 +803,7 @@ dpb_find_lowest_poc (GstVaapiDecoderH264 * decoder,
{
GstVaapiDecoderH264Private *const priv = &decoder->priv;
GstVaapiPictureH264 *found_picture = NULL;
- guint i, j, found_index;
+ guint i, j, found_index = -1;
for (i = 0; i < priv->dpb_count; i++) {
GstVaapiFrameStore *const fs = priv->dpb[i];
@@ -824,7 +824,7 @@ dpb_find_lowest_poc (GstVaapiDecoderH264 * decoder,
if (found_picture_ptr)
*found_picture_ptr = found_picture;
- return found_picture ? found_index : -1;
+ return found_index;
}
/* Finds the picture with the lowest VOC that needs to be output */
@@ -834,7 +834,7 @@ dpb_find_lowest_voc (GstVaapiDecoderH264 * decoder,
{
GstVaapiDecoderH264Private *const priv = &decoder->priv;
GstVaapiPictureH264 *found_picture = NULL;
- guint i, j, found_index;
+ guint i, j, found_index = -1;
for (i = 0; i < priv->dpb_count; i++) {
GstVaapiFrameStore *const fs = priv->dpb[i];
@@ -851,7 +851,7 @@ dpb_find_lowest_voc (GstVaapiDecoderH264 * decoder,
if (found_picture_ptr)
*found_picture_ptr = found_picture;
- return found_picture ? found_index : -1;
+ return found_index;
}
static gboolean
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h265.c b/gst-libs/gst/vaapi/gstvaapidecoder_h265.c
index 6147e0c8..2675f79a 100644
--- a/gst-libs/gst/vaapi/gstvaapidecoder_h265.c
+++ b/gst-libs/gst/vaapi/gstvaapidecoder_h265.c
@@ -711,7 +711,7 @@ dpb_find_lowest_poc (GstVaapiDecoderH265 * decoder,
{
GstVaapiDecoderH265Private *const priv = &decoder->priv;
GstVaapiPictureH265 *found_picture = NULL;
- guint i, found_index;
+ guint i, found_index = -1;
for (i = 0; i < priv->dpb_count; i++) {
GstVaapiPictureH265 *const picture = priv->dpb[i]->buffer;
@@ -723,7 +723,7 @@ dpb_find_lowest_poc (GstVaapiDecoderH265 * decoder,
if (found_picture_ptr)
*found_picture_ptr = found_picture;
- return found_picture ? found_index : -1;
+ return found_index;
}
static gboolean