omxh26xenc: fix coverity with frame test

Coverity was complaining with:
Null pointer dereferences  (REVERSE_INULL) Null-checking "frame"
suggests that it may be null, but it has already been
dereferenced on all paths leading to the check.

The frame == NULL has been removed as 'frame' is actively used
in the code above without any change of dereferencing and setting
its value to NULL before the test.

CID: 1461287
This commit is contained in:
Stéphane Cerveau 2020-04-07 19:59:12 +02:00
parent 7d5175a80f
commit 84e9906076
4 changed files with 13 additions and 9 deletions

View file

@ -879,8 +879,6 @@ gst_omx_h264_enc_handle_output_frame (GstOMXVideoEnc * enc, GstOMXPort * port,
frame->output_buffer = hdrs;
flow_ret =
gst_video_encoder_finish_subframe (GST_VIDEO_ENCODER (self), frame);
if (frame)
gst_video_codec_frame_unref (frame);
return flow_ret;

View file

@ -730,12 +730,9 @@ gst_omx_h265_enc_handle_output_frame (GstOMXVideoEnc * enc, GstOMXPort * port,
buf->omx_buf->nFilledLen);
gst_buffer_unmap (hdrs, &map);
self->headers = g_list_append (self->headers, gst_buffer_ref (hdrs));
frame->output_buffer = hdrs;
flow_ret =
gst_video_encoder_finish_subframe (GST_VIDEO_ENCODER (self), frame);
if (frame)
gst_video_codec_frame_unref (frame);
return flow_ret;

View file

@ -225,7 +225,8 @@ gst_omx_video_find_nearest_frame (GstElement * element, GstOMXBuffer * buf,
GST_TIME_FORMAT ") seems too high (%" GST_TIME_FORMAT ")",
GST_TIME_ARGS (timestamp), best->system_frame_number,
GST_TIME_ARGS (best->pts), GST_TIME_ARGS (best_diff));
}
} else
GST_WARNING_OBJECT (element, "No best frame has been found");
g_list_foreach (frames, (GFunc) gst_video_codec_frame_unref, NULL);
g_list_free (frames);

View file

@ -1707,7 +1707,15 @@ gst_omx_video_enc_loop (GstOMXVideoEnc * self)
gst_video_encoder_get_frames (GST_VIDEO_ENCODER (self)));
g_assert (klass->handle_output_frame);
flow_ret = klass->handle_output_frame (self, self->enc_out_port, buf, frame);
if (frame)
flow_ret =
klass->handle_output_frame (self, self->enc_out_port, buf, frame);
else {
gst_omx_port_release_buffer (self->enc_out_port, buf);
goto flow_error;
}
GST_DEBUG_OBJECT (self, "Finished frame: %s", gst_flow_get_name (flow_ret));