diff options
author | Stéphane Cerveau <scerveau@collabora.com> | 2020-04-07 19:59:12 +0200 |
---|---|---|
committer | Stéphane Cerveau <scerveau@collabora.com> | 2020-04-08 16:54:24 +0200 |
commit | 84e99060760ee0d9b1e02d2bd98f333428102fdb (patch) | |
tree | 50acbd1a90a5d1474c3d92bedd62a0b9e548eb01 /omx | |
parent | 7d5175a80f55cee98f8d0dee40b2db2601e4b138 (diff) |
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
Diffstat (limited to 'omx')
-rw-r--r-- | omx/gstomxh264enc.c | 4 | ||||
-rw-r--r-- | omx/gstomxh265enc.c | 5 | ||||
-rw-r--r-- | omx/gstomxvideo.c | 3 | ||||
-rw-r--r-- | omx/gstomxvideoenc.c | 10 |
4 files changed, 13 insertions, 9 deletions
diff --git a/omx/gstomxh264enc.c b/omx/gstomxh264enc.c index 94963e1..51d84a8 100644 --- a/omx/gstomxh264enc.c +++ b/omx/gstomxh264enc.c @@ -879,9 +879,7 @@ 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); + gst_video_codec_frame_unref (frame); return flow_ret; } else if (self->headers) { diff --git a/omx/gstomxh265enc.c b/omx/gstomxh265enc.c index aaddd5f..3fd8c0d 100644 --- a/omx/gstomxh265enc.c +++ b/omx/gstomxh265enc.c @@ -730,13 +730,10 @@ 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); + gst_video_codec_frame_unref (frame); return flow_ret; } else if (self->headers) { diff --git a/omx/gstomxvideo.c b/omx/gstomxvideo.c index 28d7bd1..a761e70 100644 --- a/omx/gstomxvideo.c +++ b/omx/gstomxvideo.c @@ -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); diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c index 42a8db4..5da6085 100644 --- a/omx/gstomxvideoenc.c +++ b/omx/gstomxvideoenc.c @@ -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)); |